@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * Implementation of HOOK_theme(). |
| 68 | 68 | */ |
| 69 | 69 | function boinc_theme(&$existing, $type, $theme, $path) { |
| 70 | - $hooks = zen_theme($existing, $type, $theme, $path); |
|
| 71 | - // Add your theme hooks like this: |
|
| 72 | - /* |
|
| 70 | + $hooks = zen_theme($existing, $type, $theme, $path); |
|
| 71 | + // Add your theme hooks like this: |
|
| 72 | + /* |
|
| 73 | 73 | $hooks['hook_name_here'] = array( // Details go here ); |
| 74 | 74 | */ |
| 75 | - // @TODO: Needs detailed comments. Patches welcome! |
|
| 76 | - return $hooks; |
|
| 75 | + // @TODO: Needs detailed comments. Patches welcome! |
|
| 76 | + return $hooks; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
@@ -81,43 +81,43 @@ discard block |
||
| 81 | 81 | * Adjust the rendering of the menu |
| 82 | 82 | */ |
| 83 | 83 | function boinc_links__system_main_menu($links, $menu, $element) { |
| 84 | - $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n"; |
|
| 85 | - $item_count = count($links); |
|
| 86 | - $i = 1; |
|
| 87 | - foreach ($links as $key => $link) { |
|
| 84 | + $html .= '<ul id="' . $menu['id'] . '" class="' . $menu['class'] . '">' . "\n"; |
|
| 85 | + $item_count = count($links); |
|
| 86 | + $i = 1; |
|
| 87 | + foreach ($links as $key => $link) { |
|
| 88 | 88 | $classes = array($key); |
| 89 | 89 | if (strpos($key, 'active-trail')) $classes[] = 'active'; |
| 90 | 90 | if ($i == 1) $classes[] = 'first'; |
| 91 | 91 | if ($i == $item_count) $classes[] = 'last'; |
| 92 | 92 | $html .= '<li class="' . implode(' ', $classes) .'">'; |
| 93 | 93 | if ($link['title'] == 'Home') { |
| 94 | - $link['title'] = bts('Home', array(), NULL, 'boinc:menu-link'); |
|
| 94 | + $link['title'] = bts('Home', array(), NULL, 'boinc:menu-link'); |
|
| 95 | 95 | } |
| 96 | 96 | if (module_exists('privatemsg')) { |
| 97 | - // Put a new mail notification next to the Account menu item |
|
| 98 | - if ($link['href'] == 'dashboard') { |
|
| 97 | + // Put a new mail notification next to the Account menu item |
|
| 98 | + if ($link['href'] == 'dashboard') { |
|
| 99 | 99 | $item_count = privatemsg_unread_count(); |
| 100 | 100 | if ($item_count) { |
| 101 | - $link['title'] .= '</a> <a href="' . url('messages') . '" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
|
| 102 | - $link['html'] = TRUE; |
|
| 103 | - $link['attributes']['class'] = 'compound'; |
|
| 101 | + $link['title'] .= '</a> <a href="' . url('messages') . '" class="compound secondary"><div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
|
| 102 | + $link['html'] = TRUE; |
|
| 103 | + $link['attributes']['class'] = 'compound'; |
|
| 104 | + } |
|
| 104 | 105 | } |
| 105 | - } |
|
| 106 | 106 | } |
| 107 | 107 | // Put a count of items on the Moderation menu item |
| 108 | 108 | if ($link['href'] == 'moderate') { |
| 109 | - $item_count = boincuser_moderation_queue_count(); |
|
| 110 | - if ($item_count) { |
|
| 109 | + $item_count = boincuser_moderation_queue_count(); |
|
| 110 | + if ($item_count) { |
|
| 111 | 111 | $link['title'] .= ' <div class="item-count-wrapper"><span class="item-count">' . $item_count . '</span></div>'; |
| 112 | 112 | $link['html'] = TRUE; |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | } |
| 115 | 115 | $html .= l($link['title'], $link['href'], $link); |
| 116 | 116 | $html .= '</li>'; |
| 117 | 117 | $i++; |
| 118 | - } |
|
| 119 | - $html .= '</ul>' . "\n"; |
|
| 120 | - return $html; |
|
| 118 | + } |
|
| 119 | + $html .= '</ul>' . "\n"; |
|
| 120 | + return $html; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | * Remove undesired local task tabs |
| 126 | 126 | */ |
| 127 | 127 | function boinc_menu_local_task($link, $active = FALSE) { |
| 128 | - if (strpos($link, 'admin/build/pages') !== FALSE |
|
| 128 | + if (strpos($link, 'admin/build/pages') !== FALSE |
|
| 129 | 129 | AND strpos($link, 'Edit Panel')) { |
| 130 | 130 | // Remove Edit Panel tab |
| 131 | 131 | return ''; |
| 132 | - } |
|
| 133 | - else { |
|
| 132 | + } |
|
| 133 | + else { |
|
| 134 | 134 | return '<li '. ($active ? 'class="active" ' : '') .'>'. $link ."</li>\n"; |
| 135 | - } |
|
| 135 | + } |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
@@ -168,103 +168,103 @@ discard block |
||
| 168 | 168 | * The name of the template being rendered ("page" in this case.) |
| 169 | 169 | */ |
| 170 | 170 | function boinc_preprocess_page(&$vars, $hook) { |
| 171 | - // Responsive Design: Add viewport meta tag to HTML head |
|
| 172 | - drupal_set_html_head('<meta name="viewport" content="width=device-width, initial-scale=1.0" />'); |
|
| 173 | - $vars['head'] = drupal_get_html_head(); |
|
| 174 | - //dpm($vars['head'], "preprocess (all) vars[head]"); |
|
| 175 | - |
|
| 176 | - // Expose comments to template files; this is needed so that comments can be |
|
| 177 | - // rendered in locations other than directly below the node content |
|
| 178 | - $vars['comments'] = $vars['comment_form'] = ''; |
|
| 179 | - if (module_exists('comment') && isset($vars['node'])) { |
|
| 171 | + // Responsive Design: Add viewport meta tag to HTML head |
|
| 172 | + drupal_set_html_head('<meta name="viewport" content="width=device-width, initial-scale=1.0" />'); |
|
| 173 | + $vars['head'] = drupal_get_html_head(); |
|
| 174 | + //dpm($vars['head'], "preprocess (all) vars[head]"); |
|
| 175 | + |
|
| 176 | + // Expose comments to template files; this is needed so that comments can be |
|
| 177 | + // rendered in locations other than directly below the node content |
|
| 178 | + $vars['comments'] = $vars['comment_form'] = ''; |
|
| 179 | + if (module_exists('comment') && isset($vars['node'])) { |
|
| 180 | 180 | $vars['comments'] = comment_render($vars['node']); |
| 181 | 181 | $vars['comment_form'] = drupal_get_form('comment_form', array('nid' => $vars['node']->nid)); |
| 182 | - } |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - // Determine locale region code so the correct flag is displayed in footer |
|
| 185 | - global $language; |
|
| 186 | - global $theme_path; |
|
| 187 | - $locality = $language->language; |
|
| 188 | - if (strpos($language->language, '-')) { |
|
| 184 | + // Determine locale region code so the correct flag is displayed in footer |
|
| 185 | + global $language; |
|
| 186 | + global $theme_path; |
|
| 187 | + $locality = $language->language; |
|
| 188 | + if (strpos($language->language, '-')) { |
|
| 189 | 189 | $flag_icon = "{$theme_path}/images/flags/{$language->language}.png"; |
| 190 | 190 | if (!file_exists($flag_icon)) { |
| 191 | - $lang_code = explode('-', $language->language); |
|
| 192 | - $locality = $lang_code[0]; |
|
| 191 | + $lang_code = explode('-', $language->language); |
|
| 192 | + $locality = $lang_code[0]; |
|
| 193 | 193 | } |
| 194 | - } |
|
| 195 | - // If there is no language set for some reason, default to English (en). |
|
| 196 | - if (empty($locality)) { |
|
| 194 | + } |
|
| 195 | + // If there is no language set for some reason, default to English (en). |
|
| 196 | + if (empty($locality)) { |
|
| 197 | 197 | $locality = "en"; |
| 198 | - } |
|
| 199 | - $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png"; |
|
| 198 | + } |
|
| 199 | + $vars['flag_path'] = base_path() . path_to_theme() . "/images/flags/{$locality}.png"; |
|
| 200 | 200 | |
| 201 | - $server_status_url = variable_get('boinc_server_status_url', ''); |
|
| 202 | - if (!$server_status_url) { |
|
| 201 | + $server_status_url = variable_get('boinc_server_status_url', ''); |
|
| 202 | + if (!$server_status_url) { |
|
| 203 | 203 | $server_status_url = 'server_status.php'; |
| 204 | - } |
|
| 205 | - $vars['server_status_url'] = $server_status_url; |
|
| 204 | + } |
|
| 205 | + $vars['server_status_url'] = $server_status_url; |
|
| 206 | 206 | |
| 207 | - $app_list_url = variable_get('boinc_app_list_url', ''); |
|
| 208 | - if (!$app_list_url) { |
|
| 207 | + $app_list_url = variable_get('boinc_app_list_url', ''); |
|
| 208 | + if (!$app_list_url) { |
|
| 209 | 209 | $app_list_url = 'apps.php'; |
| 210 | - } |
|
| 211 | - $vars['app_list_url'] = $app_list_url; |
|
| 212 | - |
|
| 213 | - // Remove title from certain pages using URL. |
|
| 214 | - // This is a kludge to remove the title of the page but not the |
|
| 215 | - // "head_title" which is placed in the HTML <head> section. Most of |
|
| 216 | - // these pages are defined in the Page Manager module. |
|
| 217 | - // See: https://dev.gridrepublic.org/browse/DBOINC-65 |
|
| 218 | - if (arg(0) == 'search') { |
|
| 210 | + } |
|
| 211 | + $vars['app_list_url'] = $app_list_url; |
|
| 212 | + |
|
| 213 | + // Remove title from certain pages using URL. |
|
| 214 | + // This is a kludge to remove the title of the page but not the |
|
| 215 | + // "head_title" which is placed in the HTML <head> section. Most of |
|
| 216 | + // these pages are defined in the Page Manager module. |
|
| 217 | + // See: https://dev.gridrepublic.org/browse/DBOINC-65 |
|
| 218 | + if (arg(0) == 'search') { |
|
| 219 | 219 | unset($vars['title']); |
| 220 | - } |
|
| 221 | - else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) { |
|
| 220 | + } |
|
| 221 | + else if ( (arg(0)=='account') AND (is_numeric(arg(1))) AND (empty(arg(2))) ) { |
|
| 222 | 222 | unset($vars['title']); |
| 223 | - } |
|
| 224 | - else if ( (arg(0)=='account') AND (arg(1)=='profile') ) { |
|
| 223 | + } |
|
| 224 | + else if ( (arg(0)=='account') AND (arg(1)=='profile') ) { |
|
| 225 | 225 | unset($vars['title']); |
| 226 | - } |
|
| 227 | - else if ( (arg(0)=='dashboard') ) { |
|
| 226 | + } |
|
| 227 | + else if ( (arg(0)=='dashboard') ) { |
|
| 228 | 228 | unset($vars['title']); |
| 229 | - } |
|
| 230 | - else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) { |
|
| 229 | + } |
|
| 230 | + else if ( (arg(0)=='community') AND ( (arg(1)=='teams') OR (arg(1)=='stats') ) ) { |
|
| 231 | 231 | unset($vars['title']); |
| 232 | - } |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | - // Apply classes to tabs to allow for better styling options |
|
| 235 | - $tabs = explode("\n", $vars['tabs']); |
|
| 236 | - array_pop($tabs); |
|
| 237 | - end($tabs); |
|
| 238 | - $last_key = key($tabs); |
|
| 239 | - |
|
| 240 | - foreach ($tabs as $key => &$tab) { |
|
| 241 | - if (strpos($tab, 'li class=')) { |
|
| 242 | - if ($key == 0) { |
|
| 243 | - $tab = str_replace('li class="', 'li class="first ', $tab); |
|
| 244 | - } |
|
| 245 | - if ($key == $last_key) { |
|
| 246 | - $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>'; |
|
| 247 | - } |
|
| 248 | - } |
|
| 249 | - elseif (strpos($tab, 'li ')) { |
|
| 250 | - if ($key == 0) { |
|
| 251 | - $tab = str_replace('li ', 'li class="first" ', $tab); |
|
| 252 | - } |
|
| 253 | - if ($key == $last_key) { |
|
| 254 | - $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>'; |
|
| 255 | - } |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - $vars['tabs'] = implode("\n", $tabs); |
|
| 234 | + // Apply classes to tabs to allow for better styling options |
|
| 235 | + $tabs = explode("\n", $vars['tabs']); |
|
| 236 | + array_pop($tabs); |
|
| 237 | + end($tabs); |
|
| 238 | + $last_key = key($tabs); |
|
| 239 | + |
|
| 240 | + foreach ($tabs as $key => &$tab) { |
|
| 241 | + if (strpos($tab, 'li class=')) { |
|
| 242 | + if ($key == 0) { |
|
| 243 | + $tab = str_replace('li class="', 'li class="first ', $tab); |
|
| 244 | + } |
|
| 245 | + if ($key == $last_key) { |
|
| 246 | + $tab = str_replace('li class="', 'li class="last ', $tab) . '</ul>'; |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | + elseif (strpos($tab, 'li ')) { |
|
| 250 | + if ($key == 0) { |
|
| 251 | + $tab = str_replace('li ', 'li class="first" ', $tab); |
|
| 252 | + } |
|
| 253 | + if ($key == $last_key) { |
|
| 254 | + $tab = str_replace('li ', 'li class="last" ', $tab) . '</ul>'; |
|
| 255 | + } |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + $vars['tabs'] = implode("\n", $tabs); |
|
| 259 | 259 | |
| 260 | - // Get the main menu but only for the branch the page is on. |
|
| 261 | - $vars['menu_tree_onlyactive'] = menu_tree('primary-links'); |
|
| 260 | + // Get the main menu but only for the branch the page is on. |
|
| 261 | + $vars['menu_tree_onlyactive'] = menu_tree('primary-links'); |
|
| 262 | 262 | |
| 263 | - // Create tertiary menu |
|
| 264 | - $vars['tertiary_links'] = menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 2); |
|
| 263 | + // Create tertiary menu |
|
| 264 | + $vars['tertiary_links'] = menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'), 2); |
|
| 265 | 265 | |
| 266 | - // Create action links |
|
| 267 | - $vars['action_links'] = _boinc_action_links(); |
|
| 266 | + // Create action links |
|
| 267 | + $vars['action_links'] = _boinc_action_links(); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -277,79 +277,79 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | function boinc_preprocess_node(&$vars, $hook) { |
| 279 | 279 | |
| 280 | - //$vars['sample_variable'] = t('Lorem ipsum.'); |
|
| 280 | + //$vars['sample_variable'] = t('Lorem ipsum.'); |
|
| 281 | 281 | |
| 282 | - // Detach subscribe link from the links list. Subscribe link will be placed |
|
| 283 | - // on page separately from links. |
|
| 284 | - if (!empty($vars['node']->links['flag-subscriptions']['title'])) { |
|
| 282 | + // Detach subscribe link from the links list. Subscribe link will be placed |
|
| 283 | + // on page separately from links. |
|
| 284 | + if (!empty($vars['node']->links['flag-subscriptions']['title'])) { |
|
| 285 | 285 | $vars['subscribe_link'] = $vars['node']->links['flag-subscriptions']['title']; |
| 286 | 286 | unset($vars['node']->links['flag-subscriptions']); |
| 287 | - } |
|
| 287 | + } |
|
| 288 | 288 | |
| 289 | - // Optionally, run node-type-specific preprocess functions, like |
|
| 290 | - // boinc_preprocess_node_page() or boinc_preprocess_node_story(). |
|
| 291 | - $function = __FUNCTION__ . '_' . $vars['node']->type; |
|
| 292 | - if (function_exists($function)) { |
|
| 289 | + // Optionally, run node-type-specific preprocess functions, like |
|
| 290 | + // boinc_preprocess_node_page() or boinc_preprocess_node_story(). |
|
| 291 | + $function = __FUNCTION__ . '_' . $vars['node']->type; |
|
| 292 | + if (function_exists($function)) { |
|
| 293 | 293 | $function($vars, $hook); |
| 294 | - } |
|
| 294 | + } |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * Preprocessing for forum lists |
| 299 | 299 | */ |
| 300 | 300 | function boinc_preprocess_forums(&$vars, $hook) { |
| 301 | - // Add a link to mark all forums as read |
|
| 302 | - module_load_include('inc', 'forum_tweaks', 'includes/mark-read'); |
|
| 303 | - forum_tweaks_get_mark_read_link($vars['tid'], $vars['links']); |
|
| 304 | - if (!$vars['parents']) { |
|
| 301 | + // Add a link to mark all forums as read |
|
| 302 | + module_load_include('inc', 'forum_tweaks', 'includes/mark-read'); |
|
| 303 | + forum_tweaks_get_mark_read_link($vars['tid'], $vars['links']); |
|
| 304 | + if (!$vars['parents']) { |
|
| 305 | 305 | // Remove the "Post new forum topic" link from the top level forum list |
| 306 | 306 | unset($vars['links']['forum']); |
| 307 | 307 | // Add a link to manage subscriptions for the user |
| 308 | 308 | $vars['links']['subscriptions'] = array( |
| 309 | - 'title' => bts('Manage subscriptions', array(), NULL, 'boinc:forum-footer'), |
|
| 310 | - 'href' => 'account/prefs/subscriptions', |
|
| 309 | + 'title' => bts('Manage subscriptions', array(), NULL, 'boinc:forum-footer'), |
|
| 310 | + 'href' => 'account/prefs/subscriptions', |
|
| 311 | 311 | ); |
| 312 | - } |
|
| 312 | + } |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | 316 | * Preprocessing for forum type nodes |
| 317 | 317 | */ |
| 318 | 318 | function boinc_preprocess_node_forum(&$vars, $hook) { |
| 319 | - global $language; |
|
| 320 | - global $user; |
|
| 319 | + global $language; |
|
| 320 | + global $user; |
|
| 321 | 321 | |
| 322 | - // Locality |
|
| 323 | - $vars['locality'] = $language->language; |
|
| 322 | + // Locality |
|
| 323 | + $vars['locality'] = $language->language; |
|
| 324 | 324 | |
| 325 | - // Get the author of the node |
|
| 326 | - $account = user_load($vars['uid']); |
|
| 327 | - $comments_per_page = ($user->comments_per_page) ? $user->comments_per_page : variable_get("comment_default_per_page_{$vars['node']->type}", 50); |
|
| 325 | + // Get the author of the node |
|
| 326 | + $account = user_load($vars['uid']); |
|
| 327 | + $comments_per_page = ($user->comments_per_page) ? $user->comments_per_page : variable_get("comment_default_per_page_{$vars['node']->type}", 50); |
|
| 328 | 328 | |
| 329 | - // Add signature |
|
| 330 | - $vars['signature'] = check_markup($account->signature, $vars['node']->format); |
|
| 329 | + // Add signature |
|
| 330 | + $vars['signature'] = check_markup($account->signature, $vars['node']->format); |
|
| 331 | 331 | |
| 332 | - // Show signatures based on user preference |
|
| 333 | - $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE; |
|
| 332 | + // Show signatures based on user preference |
|
| 333 | + $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE; |
|
| 334 | 334 | |
| 335 | - // Expose comment sort order so that the template can put the topic node |
|
| 336 | - // content (i.e. initial post) at the very end if "Newest post first" is the |
|
| 337 | - // preference used by this user |
|
| 338 | - $vars['oldest_post_first'] = ($user->sort != 1) ? TRUE : FALSE; |
|
| 339 | - $vars['node']->comment = 0; |
|
| 335 | + // Expose comment sort order so that the template can put the topic node |
|
| 336 | + // content (i.e. initial post) at the very end if "Newest post first" is the |
|
| 337 | + // preference used by this user |
|
| 338 | + $vars['oldest_post_first'] = ($user->sort != 1) ? TRUE : FALSE; |
|
| 339 | + $vars['node']->comment = 0; |
|
| 340 | 340 | |
| 341 | - $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1)); |
|
| 342 | - $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1); |
|
| 343 | - $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1)); |
|
| 344 | - |
|
| 345 | - $links = $vars['links']; |
|
| 346 | - $moderator_links = array(); |
|
| 347 | - _boinc_create_moderator_links($links, $moderator_links); |
|
| 348 | - $vars['links'] = $links; |
|
| 349 | - $vars['moderator_links'] = $moderator_links; |
|
| 350 | - |
|
| 351 | - // Ignore user link |
|
| 352 | - $vars['ignore_link'] = _boinc_ignore_user_link('node', $vars['node']); |
|
| 341 | + $vars['first_page'] = (!isset($_GET['page']) OR ($_GET['page'] < 1)); |
|
| 342 | + $page_count = max(ceil($vars['comment_count'] / $comments_per_page), 1); |
|
| 343 | + $vars['last_page'] = ($page_count == 1 OR ($page_count > 1 AND $_GET['page'] == $page_count - 1)); |
|
| 344 | + |
|
| 345 | + $links = $vars['links']; |
|
| 346 | + $moderator_links = array(); |
|
| 347 | + _boinc_create_moderator_links($links, $moderator_links); |
|
| 348 | + $vars['links'] = $links; |
|
| 349 | + $vars['moderator_links'] = $moderator_links; |
|
| 350 | + |
|
| 351 | + // Ignore user link |
|
| 352 | + $vars['ignore_link'] = _boinc_ignore_user_link('node', $vars['node']); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | |
@@ -370,48 +370,48 @@ discard block |
||
| 370 | 370 | * The name of the template being rendered ("comment" in this case.) |
| 371 | 371 | */ |
| 372 | 372 | function boinc_preprocess_comment(&$vars, $hook) { |
| 373 | - global $language; |
|
| 374 | - global $user; |
|
| 373 | + global $language; |
|
| 374 | + global $user; |
|
| 375 | 375 | |
| 376 | - // Locality |
|
| 377 | - $vars['locality'] = $language->language; |
|
| 376 | + // Locality |
|
| 377 | + $vars['locality'] = $language->language; |
|
| 378 | 378 | |
| 379 | - // Show signatures based on user preference |
|
| 380 | - $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE; |
|
| 379 | + // Show signatures based on user preference |
|
| 380 | + $vars['show_signatures'] = ($user->hide_signatures) ? FALSE : TRUE; |
|
| 381 | 381 | |
| 382 | - $links = $vars['links']; |
|
| 383 | - $moderator_links = array(); |
|
| 384 | - _boinc_create_moderator_links($links, $moderator_links); |
|
| 385 | - $vars['links'] = $links; |
|
| 386 | - $vars['moderator_links'] = $moderator_links; |
|
| 382 | + $links = $vars['links']; |
|
| 383 | + $moderator_links = array(); |
|
| 384 | + _boinc_create_moderator_links($links, $moderator_links); |
|
| 385 | + $vars['links'] = $links; |
|
| 386 | + $vars['moderator_links'] = $moderator_links; |
|
| 387 | 387 | |
| 388 | - // Ignore user link |
|
| 389 | - $vars['ignore_link'] = _boinc_ignore_user_link('comment', $vars['comment']); |
|
| 388 | + // Ignore user link |
|
| 389 | + $vars['ignore_link'] = _boinc_ignore_user_link('comment', $vars['comment']); |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /** |
| 393 | 393 | * |
| 394 | 394 | */ |
| 395 | 395 | function boinc_preprocess_forum_topic_list(&$variables) { |
| 396 | - if (!empty($variables['topics'])) { |
|
| 396 | + if (!empty($variables['topics'])) { |
|
| 397 | 397 | foreach ($variables['topics'] as $id => $topic) { |
| 398 | - if ($topic->new_replies) { |
|
| 398 | + if ($topic->new_replies) { |
|
| 399 | 399 | $cid = boincuser_get_first_unread_comment_id($topic->nid); |
| 400 | 400 | if ($cid) { |
| 401 | - $variables['topics'][$id]->new_url = url("goto/comment/{$cid}"); |
|
| 401 | + $variables['topics'][$id]->new_url = url("goto/comment/{$cid}"); |
|
| 402 | 402 | } |
| 403 | 403 | else { |
| 404 | - // User hasn't visited this topic before, so all replies are new... |
|
| 405 | - $topic->new_replies = NULL; |
|
| 404 | + // User hasn't visited this topic before, so all replies are new... |
|
| 405 | + $topic->new_replies = NULL; |
|
| 406 | + } |
|
| 406 | 407 | } |
| 407 | - } |
|
| 408 | - // Use same logic in forum.module to change message if topic has |
|
| 409 | - // moved. Changed link to match boinc path-added "community". |
|
| 410 | - if ($topic->forum_tid != $variables['tid']) { |
|
| 408 | + // Use same logic in forum.module to change message if topic has |
|
| 409 | + // moved. Changed link to match boinc path-added "community". |
|
| 410 | + if ($topic->forum_tid != $variables['tid']) { |
|
| 411 | 411 | $variables['topics'][$id]->message = l(t('This topic has been moved'), "community/forum/$topic->forum_tid"); |
| 412 | - } |
|
| 412 | + } |
|
| 413 | + } |
|
| 413 | 414 | } |
| 414 | - } |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | /** |
@@ -424,79 +424,79 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | ///* -- Delete this line if you want to use this function |
| 426 | 426 | function boinc_preprocess_views_view(&$vars, $hook) { |
| 427 | - switch ($vars['name']) { |
|
| 428 | - case 'boinc_account_computers': |
|
| 427 | + switch ($vars['name']) { |
|
| 428 | + case 'boinc_account_computers': |
|
| 429 | 429 | switch ($vars['display_id']) { |
| 430 | 430 | case 'page_1': |
| 431 | 431 | case 'panel_pane_1': |
| 432 | 432 | $vars['empty'] = boincwork_views_host_list_empty_text(); |
| 433 | - break; |
|
| 433 | + break; |
|
| 434 | 434 | case 'page_2': |
| 435 | 435 | $vars['empty'] = boincwork_views_host_list_empty_text('active'); |
| 436 | - break; |
|
| 436 | + break; |
|
| 437 | 437 | case 'block_1': |
| 438 | 438 | $vars['empty'] = boincwork_views_host_list_empty_text('preferences'); |
| 439 | - break; |
|
| 439 | + break; |
|
| 440 | 440 | default: |
| 441 | 441 | } |
| 442 | 442 | break; |
| 443 | - case 'boinc_account_tasks_all': |
|
| 443 | + case 'boinc_account_tasks_all': |
|
| 444 | 444 | $vars['empty'] = boincwork_views_task_list_empty_text(); |
| 445 | 445 | break; |
| 446 | - case 'boinc_friends': |
|
| 446 | + case 'boinc_friends': |
|
| 447 | 447 | if ($vars['display_id'] == 'block_1') { |
| 448 | - $vars['header'] = boincuser_views_friends_block_header(); |
|
| 448 | + $vars['header'] = boincuser_views_friends_block_header(); |
|
| 449 | 449 | } |
| 450 | 450 | break; |
| 451 | - case 'boinc_host': |
|
| 451 | + case 'boinc_host': |
|
| 452 | 452 | $view = views_get_current_view(); |
| 453 | - if (!($view->result)) { |
|
| 453 | + if (!($view->result)) { |
|
| 454 | 454 | $vars['footer'] = '<h3>' . bts ('Host not found in database.', array(), NULL, 'boinc:host-details') . '</h3>'; |
| 455 | - } |
|
| 455 | + } |
|
| 456 | 456 | break; |
| 457 | - case 'boinc_host_list': |
|
| 457 | + case 'boinc_host_list': |
|
| 458 | 458 | if ($vars['display_id'] == 'page_2') { |
| 459 | - $vars['empty'] = boincwork_views_host_list_empty_text(); |
|
| 459 | + $vars['empty'] = boincwork_views_host_list_empty_text(); |
|
| 460 | 460 | } |
| 461 | 461 | elseif ($vars['display_id'] == 'page_1') { |
| 462 | - $vars['empty'] = boincwork_views_host_list_empty_text('active'); |
|
| 462 | + $vars['empty'] = boincwork_views_host_list_empty_text('active'); |
|
| 463 | 463 | } |
| 464 | 464 | break; |
| 465 | - case 'boinc_task': |
|
| 465 | + case 'boinc_task': |
|
| 466 | 466 | // Load view object (view data is not available in header / footer); execute view query |
| 467 | 467 | $view = views_get_current_view(); |
| 468 | 468 | $view->execute(); |
| 469 | 469 | $result = reset($view->result); |
| 470 | 470 | |
| 471 | 471 | if ($result) { |
| 472 | - // Display the stderr output in the footer |
|
| 473 | - $vars['footer'] = '<h3>' . bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog') .'</h3>'; |
|
| 474 | - $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>'; |
|
| 472 | + // Display the stderr output in the footer |
|
| 473 | + $vars['footer'] = '<h3>' . bts('Stderr output', array(), NULL, 'boinc:task-details-errorlog') .'</h3>'; |
|
| 474 | + $vars['footer'] .= '<pre>' . htmlspecialchars($result->result_stderr_out) . '</pre>'; |
|
| 475 | 475 | } else { |
| 476 | - $vars['footer'] = '<h3>' . bts ('Task not found in database.', array(), NULL, 'boinc:task-details') . '</h3>'; |
|
| 476 | + $vars['footer'] = '<h3>' . bts ('Task not found in database.', array(), NULL, 'boinc:task-details') . '</h3>'; |
|
| 477 | 477 | } |
| 478 | 478 | break; |
| 479 | - case 'boinc_teams': |
|
| 479 | + case 'boinc_teams': |
|
| 480 | 480 | if ($vars['display_id'] == 'panel_pane_3') { |
| 481 | - $team_id = arg(2); |
|
| 482 | - $vars['header'] = boincteam_manage_admins_panel_header($team_id); |
|
| 481 | + $team_id = arg(2); |
|
| 482 | + $vars['header'] = boincteam_manage_admins_panel_header($team_id); |
|
| 483 | 483 | } |
| 484 | 484 | break; |
| 485 | - case 'boinc_workunit': |
|
| 485 | + case 'boinc_workunit': |
|
| 486 | 486 | ob_start(); |
| 487 | 487 | // Get the workunit ID from the URL |
| 488 | 488 | $result_id = arg(1); |
| 489 | 489 | require_boinc(array('util','boinc_db')); |
| 490 | 490 | $wu = BoincWorkunit::lookup_id($result_id); |
| 491 | 491 | if ($wu) { |
| 492 | - // Output from admin defined BOINC project-specific function |
|
| 493 | - project_workunit($wu); |
|
| 494 | - // Output of project_workunit() gets caught in the buffer |
|
| 495 | - $vars['footer'] = ob_get_clean(); |
|
| 492 | + // Output from admin defined BOINC project-specific function |
|
| 493 | + project_workunit($wu); |
|
| 494 | + // Output of project_workunit() gets caught in the buffer |
|
| 495 | + $vars['footer'] = ob_get_clean(); |
|
| 496 | 496 | } else { |
| 497 | - $vars['footer'] = '<h3>' . bts ('Workunit not found in database.', array(), NULL, 'boinc:workunit-details') . '</h3>'; |
|
| 497 | + $vars['footer'] = '<h3>' . bts ('Workunit not found in database.', array(), NULL, 'boinc:workunit-details') . '</h3>'; |
|
| 498 | 498 | } |
| 499 | - default: |
|
| 499 | + default: |
|
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | // */ |
@@ -509,19 +509,19 @@ discard block |
||
| 509 | 509 | */ |
| 510 | 510 | ///* -- Delete this line if you want to use this function |
| 511 | 511 | function boinc_preprocess_privatemsg_view(&$vars, $hook) { |
| 512 | - $author_picture = '<div class="picture">'; |
|
| 513 | - $user_image = boincuser_get_user_profile_image($vars['message']['author']->uid); |
|
| 514 | - if ($user_image) { |
|
| 512 | + $author_picture = '<div class="picture">'; |
|
| 513 | + $user_image = boincuser_get_user_profile_image($vars['message']['author']->uid); |
|
| 514 | + if ($user_image) { |
|
| 515 | 515 | if (is_array($user_image) AND $user_image['image']['filepath']) { |
| 516 | - $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
|
| 516 | + $author_picture .= theme('imagefield_image', $user_image['image'], $user_image['alt'], $user_image['alt'], array(), false); |
|
| 517 | 517 | } |
| 518 | 518 | elseif (is_string($user_image)) { |
| 519 | - $author_picture .= '<img src="' . $user_image . '"/>'; |
|
| 519 | + $author_picture .= '<img src="' . $user_image . '"/>'; |
|
| 520 | 520 | } |
| 521 | - } |
|
| 522 | - $author_picture .= '</div>'; |
|
| 523 | - $vars['author_picture'] = $author_picture; |
|
| 524 | - $vars['message_timestamp'] = date('j M Y G:i:s T', $vars['message']['timestamp']); |
|
| 521 | + } |
|
| 522 | + $author_picture .= '</div>'; |
|
| 523 | + $vars['author_picture'] = $author_picture; |
|
| 524 | + $vars['message_timestamp'] = date('j M Y G:i:s T', $vars['message']['timestamp']); |
|
| 525 | 525 | } |
| 526 | 526 | // */ |
| 527 | 527 | |
@@ -540,19 +540,19 @@ discard block |
||
| 540 | 540 | // */ |
| 541 | 541 | |
| 542 | 542 | function boinc_preprocess_search_result(&$variables) { |
| 543 | - global $language; |
|
| 544 | - // Locality |
|
| 545 | - $variables['locality'] = $language->language; |
|
| 543 | + global $language; |
|
| 544 | + // Locality |
|
| 545 | + $variables['locality'] = $language->language; |
|
| 546 | 546 | |
| 547 | - // Change the format of the search result date/time in the info string. |
|
| 548 | - if ($variables['result']['date']) { |
|
| 547 | + // Change the format of the search result date/time in the info string. |
|
| 548 | + if ($variables['result']['date']) { |
|
| 549 | 549 | $variables['info_split']['date'] = date('j M Y G:i:s T', $variables['result']['date']); |
| 550 | - } |
|
| 551 | - $variables['info'] = implode(' - ', $variables['info_split']); |
|
| 550 | + } |
|
| 551 | + $variables['info'] = implode(' - ', $variables['info_split']); |
|
| 552 | 552 | |
| 553 | - $type = strtolower($variables['result']['bundle']); |
|
| 554 | - switch ($type) { |
|
| 555 | - case 'profile': |
|
| 553 | + $type = strtolower($variables['result']['bundle']); |
|
| 554 | + switch ($type) { |
|
| 555 | + case 'profile': |
|
| 556 | 556 | case 'user': |
| 557 | 557 | $node = $variables['result']['node']; |
| 558 | 558 | $variables['url'] = url('account/' . $node->is_uid); |
@@ -560,20 +560,20 @@ discard block |
||
| 560 | 560 | $variables['user_image'] = boincuser_get_user_profile_image($node->is_uid); |
| 561 | 561 | $variables['account'] = user_load($node->is_uid); |
| 562 | 562 | break; |
| 563 | - case 'team': |
|
| 563 | + case 'team': |
|
| 564 | 564 | $node = $variables['result']['node']; |
| 565 | 565 | $variables['url'] = url('/community/teams/' . $node->entity_id);; |
| 566 | 566 | break; |
| 567 | - case 'forum': |
|
| 567 | + case 'forum': |
|
| 568 | 568 | $node = $variables['result']['node']; |
| 569 | 569 | $drupalnode = node_load($node->entity_id); |
| 570 | 570 | // Get the taxonomy for the node, creates a link to the parent forum |
| 571 | 571 | $taxonomy = reset($drupalnode->taxonomy); |
| 572 | 572 | if ($vocab = taxonomy_vocabulary_load($taxonomy->vid)) { |
| 573 | - $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}"); |
|
| 573 | + $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}"); |
|
| 574 | 574 | } |
| 575 | 575 | break; |
| 576 | - case 'comment': |
|
| 576 | + case 'comment': |
|
| 577 | 577 | // Get the node id for this comment |
| 578 | 578 | $nid = $variables['result']['fields']['tos_content_extra']; |
| 579 | 579 | $drupalnode = node_load($nid); |
@@ -584,21 +584,21 @@ discard block |
||
| 584 | 584 | // Get the taxonomy for the node, creates a link to the parent forum |
| 585 | 585 | $taxonomy = reset($drupalnode->taxonomy); |
| 586 | 586 | if ($vocab = taxonomy_vocabulary_load($taxonomy->vid)) { |
| 587 | - $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}"); |
|
| 587 | + $variables['parent_forum'] = l($taxonomy->name, "community/forum/{$taxonomy->tid}"); |
|
| 588 | 588 | } |
| 589 | - break; |
|
| 590 | - default: |
|
| 589 | + break; |
|
| 590 | + default: |
|
| 591 | 591 | } |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | // Remove the mess of text under the search form and don't display "no results" |
| 595 | 595 | // if a search hasn't even been submitted |
| 596 | 596 | function boinc_apachesolr_search_noresults() { |
| 597 | - $message = bts('No results found...', array(), NULL, 'boinc:search-with-no-results'); |
|
| 598 | - if (!arg(2)) { |
|
| 597 | + $message = bts('No results found...', array(), NULL, 'boinc:search-with-no-results'); |
|
| 598 | + if (!arg(2)) { |
|
| 599 | 599 | $message = ''; |
| 600 | - } |
|
| 601 | - return '<p>' . $message . '</p>'; |
|
| 600 | + } |
|
| 601 | + return '<p>' . $message . '</p>'; |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | /** |
@@ -607,42 +607,42 @@ discard block |
||
| 607 | 607 | */ |
| 608 | 608 | function phptemplate_username($object) { |
| 609 | 609 | |
| 610 | - if ($object->uid && $object->name) { |
|
| 610 | + if ($object->uid && $object->name) { |
|
| 611 | 611 | |
| 612 | 612 | // Show the profile name in general, not the username |
| 613 | 613 | $name = user_load($object->uid)->boincuser_name; |
| 614 | 614 | |
| 615 | 615 | // Shorten the name when it is too long or it will break many tables. |
| 616 | 616 | if (drupal_strlen($name) > 20) { |
| 617 | - $name = drupal_substr($name, 0, 15) . '...'; |
|
| 617 | + $name = drupal_substr($name, 0, 15) . '...'; |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | if (user_access('access user profiles')) { |
| 621 | - $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table')))); |
|
| 621 | + $output = l($name, 'account/' . $object->uid, array('attributes' => array('title' => bts('View user profile.', array(), NULL, 'boinc:users-table')))); |
|
| 622 | 622 | } |
| 623 | 623 | else { |
| 624 | - $output = check_plain($name); |
|
| 624 | + $output = check_plain($name); |
|
| 625 | 625 | } |
| 626 | - } |
|
| 627 | - else if ($object->name) { |
|
| 626 | + } |
|
| 627 | + else if ($object->name) { |
|
| 628 | 628 | // Sometimes modules display content composed by people who are |
| 629 | 629 | // not registered members of the site (e.g. mailing list or news |
| 630 | 630 | // aggregator modules). This clause enables modules to display |
| 631 | 631 | // the true author of the content. |
| 632 | 632 | if (!empty($object->homepage)) { |
| 633 | - $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); |
|
| 633 | + $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow'))); |
|
| 634 | 634 | } |
| 635 | 635 | else { |
| 636 | - $output = check_plain($object->name); |
|
| 636 | + $output = check_plain($object->name); |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | $output .= ' (' . bts('not verified', array(), NULL, 'boinc:user-not-found') . ')'; |
| 640 | - } |
|
| 641 | - else { |
|
| 640 | + } |
|
| 641 | + else { |
|
| 642 | 642 | $output = check_plain(variable_get('anonymous', bts('Anonymous', array(), NULL, 'boinc:anonymous-user'))); |
| 643 | - } |
|
| 643 | + } |
|
| 644 | 644 | |
| 645 | - return $output; |
|
| 645 | + return $output; |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | /** |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | * "More information about formatting options" |
| 651 | 651 | */ |
| 652 | 652 | function boinc_filter_tips_more_info () { |
| 653 | - return ''; |
|
| 653 | + return ''; |
|
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | /** |
@@ -668,19 +668,19 @@ discard block |
||
| 668 | 668 | * An array containing the email [type] (mailkey), [subject] and [body]. |
| 669 | 669 | */ |
| 670 | 670 | function boinc_flag_friend_message_email($status, $flag, $recipient, $sender) { |
| 671 | - $email = array(); |
|
| 672 | - $email['type'] = 'flag-friend'; |
|
| 673 | - // Reload the sender to get a full user object |
|
| 674 | - $sender = user_load($sender->uid); |
|
| 671 | + $email = array(); |
|
| 672 | + $email['type'] = 'flag-friend'; |
|
| 673 | + // Reload the sender to get a full user object |
|
| 674 | + $sender = user_load($sender->uid); |
|
| 675 | 675 | |
| 676 | - switch ($status) { |
|
| 676 | + switch ($status) { |
|
| 677 | 677 | case FLAG_FRIEND_FLAGGED: |
| 678 | 678 | // Sender accepted recipient's friend request |
| 679 | 679 | $email['subject'] = bts('!name accepted your friend request [!site]', array( |
| 680 | 680 | '!name' => $sender->boincuser_name, |
| 681 | 681 | '!site' => variable_get('site_name', 'Drupal-BOINC'), |
| 682 | 682 | ), NULL, 'boinc:friend-request-email'); |
| 683 | - $email['body'] = bts('!name confirmed you as a friend on !site. |
|
| 683 | + $email['body'] = bts('!name confirmed you as a friend on !site. |
|
| 684 | 684 | |
| 685 | 685 | Follow this link to view his or her profile: |
| 686 | 686 | !link |
@@ -694,12 +694,12 @@ discard block |
||
| 694 | 694 | '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '', |
| 695 | 695 | '!link' => url('account/'. $sender->uid, array('absolute' => TRUE)), |
| 696 | 696 | ), array(), NULL, 'boinc:friend-request-email'); |
| 697 | - break; |
|
| 697 | + break; |
|
| 698 | 698 | |
| 699 | 699 | case FLAG_FRIEND_PENDING: |
| 700 | 700 | // Sender is requesting to be recipient's friend |
| 701 | 701 | $email['subject'] = bts('Friend request from !name [!site]', array('!name' => $sender->boincuser_name, '!site' => variable_get('site_name', 'Drupal-BOINC')), NULL, 'boinc:friend-request-email'); |
| 702 | - $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts. |
|
| 702 | + $email['body'] = bts('!name added you as a friend on !site. You can approve or deny this request. Denying a request will not send a notification, but will remove the request from both of your accounts. |
|
| 703 | 703 | |
| 704 | 704 | Follow the link below to view this request: |
| 705 | 705 | !link |
@@ -713,26 +713,26 @@ discard block |
||
| 713 | 713 | '!message' => $flag->friend_message ? bts('Message', array(), NULL, 'boinc:friend-request-email:-1:a-private-message') . ': ' . $flag->friend_message : '', |
| 714 | 714 | '!link' => url('goto/friend-requests', array('absolute' => TRUE)), |
| 715 | 715 | ), |
| 716 | - array(), NULL, 'boinc:friend-request-email'); |
|
| 717 | - break; |
|
| 718 | - } |
|
| 719 | - return $email; |
|
| 716 | + array(), NULL, 'boinc:friend-request-email'); |
|
| 717 | + break; |
|
| 718 | + } |
|
| 719 | + return $email; |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /** |
| 723 | 723 | * Edit action links |
| 724 | 724 | */ |
| 725 | 725 | function phptemplate_links($links, $attributes = array('class' => 'links')) { |
| 726 | - if ($links){ |
|
| 726 | + if ($links){ |
|
| 727 | 727 | // Remove flag-subscriptions link. It will be placed elsewhere. |
| 728 | 728 | if (isset($links['flag-subscriptions'])) { |
| 729 | - unset($links['flag-subscriptions']); |
|
| 729 | + unset($links['flag-subscriptions']); |
|
| 730 | 730 | } |
| 731 | 731 | // Reorder the links however you need them. |
| 732 | 732 | $links = reorder_links($links, array('comment_edit','quote','comment_add','comment_reply','flag-abuse_comment','flag-abuse_node'), array('comment_delete')); |
| 733 | 733 | // Use the built-in theme_links() function to format the $links array. |
| 734 | 734 | return theme_links($links, $attributes); |
| 735 | - } |
|
| 735 | + } |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | /** |
@@ -776,8 +776,8 @@ discard block |
||
| 776 | 776 | * That is to say, get rid of it and use the views-view-table.tpl.php template. |
| 777 | 777 | */ |
| 778 | 778 | function boinc_tablesort_indicator($style) { |
| 779 | - return ''; |
|
| 780 | - /* |
|
| 779 | + return ''; |
|
| 780 | + /* |
|
| 781 | 781 | if ($style == "asc") { |
| 782 | 782 | return theme('image', 'misc/arrow-asc.png', t('sort icon'), t('sort ascending')); |
| 783 | 783 | } |
@@ -800,48 +800,48 @@ discard block |
||
| 800 | 800 | * |
| 801 | 801 | */ |
| 802 | 802 | function _boinc_create_moderator_links(&$links, &$moderator_links) { |
| 803 | - // If there are no links, then do nothing |
|
| 804 | - if (empty($links)) { |
|
| 803 | + // If there are no links, then do nothing |
|
| 804 | + if (empty($links)) { |
|
| 805 | 805 | return; |
| 806 | - } |
|
| 806 | + } |
|
| 807 | 807 | |
| 808 | - $alllinks = array(); |
|
| 809 | - $modlinks = array(); |
|
| 808 | + $alllinks = array(); |
|
| 809 | + $modlinks = array(); |
|
| 810 | 810 | |
| 811 | - // Create an array of HTML elements from the $links string, keys |
|
| 812 | - // are the class attribute for the <li> tags. |
|
| 813 | - $dom = new DOMDocument; |
|
| 814 | - $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8')); |
|
| 815 | - foreach($dom->getElementsByTagName('li') as $node) { |
|
| 811 | + // Create an array of HTML elements from the $links string, keys |
|
| 812 | + // are the class attribute for the <li> tags. |
|
| 813 | + $dom = new DOMDocument; |
|
| 814 | + $dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8')); |
|
| 815 | + foreach($dom->getElementsByTagName('li') as $node) { |
|
| 816 | 816 | $key = $node->getAttribute("class"); |
| 817 | 817 | $alllinks[$key] = $dom->saveHTML($node); |
| 818 | - } |
|
| 818 | + } |
|
| 819 | 819 | |
| 820 | - // Select classes to be placed into moderator links array |
|
| 821 | - $selected_classes = array( |
|
| 820 | + // Select classes to be placed into moderator links array |
|
| 821 | + $selected_classes = array( |
|
| 822 | 822 | "make_sticky", "make_unsticky", |
| 823 | 823 | "lock", "unlock", |
| 824 | 824 | "convert", |
| 825 | 825 | "hide", "unhide", |
| 826 | 826 | "comment_delete", |
| 827 | - ); |
|
| 828 | - foreach(array_keys($alllinks) as $key1) { |
|
| 827 | + ); |
|
| 828 | + foreach(array_keys($alllinks) as $key1) { |
|
| 829 | 829 | // Select string up to first space, if present. |
| 830 | 830 | $class1 = strtok($key1, ' '); |
| 831 | 831 | if (in_array($class1, $selected_classes)) { |
| 832 | - if (empty($modlinks)) { |
|
| 832 | + if (empty($modlinks)) { |
|
| 833 | 833 | _boinc_firstlink($alllinks[$key1]); |
| 834 | - } |
|
| 835 | - $modlinks[$key1] = $alllinks[$key1]; |
|
| 836 | - unset($alllinks[$key1]); |
|
| 834 | + } |
|
| 835 | + $modlinks[$key1] = $alllinks[$key1]; |
|
| 836 | + unset($alllinks[$key1]); |
|
| 837 | 837 | } |
| 838 | - } |
|
| 839 | - // Convert the HTML arrays back into strings, wrap them in <ul> |
|
| 840 | - // tags |
|
| 841 | - $links = "<ul class=\"links\">".implode($alllinks)."</ul>"; |
|
| 842 | - $moderator_links = "<ul class=\"links\">".implode($modlinks)."</ul>"; |
|
| 838 | + } |
|
| 839 | + // Convert the HTML arrays back into strings, wrap them in <ul> |
|
| 840 | + // tags |
|
| 841 | + $links = "<ul class=\"links\">".implode($alllinks)."</ul>"; |
|
| 842 | + $moderator_links = "<ul class=\"links\">".implode($modlinks)."</ul>"; |
|
| 843 | 843 | |
| 844 | - return; |
|
| 844 | + return; |
|
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | /* |
@@ -849,38 +849,38 @@ discard block |
||
| 849 | 849 | * attribute to class. |
| 850 | 850 | */ |
| 851 | 851 | function _boinc_firstlink(&$alink) { |
| 852 | - if (!empty($alink)) { |
|
| 852 | + if (!empty($alink)) { |
|
| 853 | 853 | $dom = new DomDocument; |
| 854 | 854 | $dom->loadHTML(mb_convert_encoding($alink, 'HTML-ENTITIES', 'UTF-8')); |
| 855 | 855 | |
| 856 | 856 | $myli = $dom->getElementsByTagName('li'); |
| 857 | 857 | if ($myli->length>0) { |
| 858 | - $newclasses = trim(($myli[0]->getAttribute("class"))." first"); |
|
| 859 | - $myli[0]->setAttribute("class", $newclasses); |
|
| 860 | - $alink = $dom->saveHTML($myli[0]); |
|
| 858 | + $newclasses = trim(($myli[0]->getAttribute("class"))." first"); |
|
| 859 | + $myli[0]->setAttribute("class", $newclasses); |
|
| 860 | + $alink = $dom->saveHTML($myli[0]); |
|
| 861 | + } |
|
| 861 | 862 | } |
| 862 | - } |
|
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | /* |
| 866 | 866 | * Private function to generate the action links |
| 867 | 867 | */ |
| 868 | 868 | function _boinc_action_links() { |
| 869 | - global $user; |
|
| 870 | - global $base_path; |
|
| 869 | + global $user; |
|
| 870 | + global $base_path; |
|
| 871 | 871 | |
| 872 | - $output = '<ul class="menu"><li class="first">'; |
|
| 873 | - if ($user->uid) { |
|
| 872 | + $output = '<ul class="menu"><li class="first">'; |
|
| 873 | + if ($user->uid) { |
|
| 874 | 874 | $output .= '<a href="' . url('logout') . '">' . bts('Logout', array(), NULL, 'boinc:menu-link') . '</a>'; |
| 875 | - } else { |
|
| 875 | + } else { |
|
| 876 | 876 | $output .= '<a href="' . url('user/login', array('query' => drupal_get_destination()) ) . '">' . bts('Login', array(), NULL, 'boinc:menu-link') . '</a>'; |
| 877 | - } |
|
| 878 | - $output .= '</li>'; |
|
| 879 | - if (module_exists('global_search') OR module_exists('global_search_solr')) { |
|
| 877 | + } |
|
| 878 | + $output .= '</li>'; |
|
| 879 | + if (module_exists('global_search') OR module_exists('global_search_solr')) { |
|
| 880 | 880 | $output .= '<li class="last"> <a class="search" href="' . url('search/site') . '">' . bts('search', array(), NULL, 'boinc:menu-link') .'</a> </l1>'; |
| 881 | - } |
|
| 882 | - $output .= '</ul>'; |
|
| 883 | - return $output; |
|
| 881 | + } |
|
| 882 | + $output .= '</ul>'; |
|
| 883 | + return $output; |
|
| 884 | 884 | } |
| 885 | 885 | |
| 886 | 886 | /** |
@@ -888,47 +888,47 @@ discard block |
||
| 888 | 888 | * function. Modified for boinc functionality. |
| 889 | 889 | */ |
| 890 | 890 | function _boinc_ignore_user_link($type, $object = NULL, $teaser = FALSE) { |
| 891 | - global $user; |
|
| 891 | + global $user; |
|
| 892 | 892 | |
| 893 | - if (!$user || !$user->uid) { |
|
| 893 | + if (!$user || !$user->uid) { |
|
| 894 | 894 | return; |
| 895 | - } |
|
| 895 | + } |
|
| 896 | 896 | |
| 897 | - static $ignored; |
|
| 898 | - $links = array(); |
|
| 897 | + static $ignored; |
|
| 898 | + $links = array(); |
|
| 899 | 899 | |
| 900 | - if ($type == 'node' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) { |
|
| 900 | + if ($type == 'node' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) { |
|
| 901 | 901 | if (!isset($ignored[$object->uid])) { |
| 902 | - $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid)); |
|
| 902 | + $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid)); |
|
| 903 | 903 | } |
| 904 | 904 | if ($ignored[$object->uid] == 0) { |
| 905 | - $links['ignore_user'] = array( |
|
| 905 | + $links['ignore_user'] = array( |
|
| 906 | 906 | 'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'), |
| 907 | 907 | 'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid, |
| 908 | 908 | 'query' => 'destination='. $_GET['q'], |
| 909 | 909 | 'attributes' => array( |
| 910 | - 'class' => 'ignore-user', |
|
| 911 | - 'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'), |
|
| 910 | + 'class' => 'ignore-user', |
|
| 911 | + 'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'), |
|
| 912 | 912 | ), |
| 913 | - ); |
|
| 913 | + ); |
|
| 914 | 914 | } |
| 915 | - } |
|
| 916 | - else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) { |
|
| 915 | + } |
|
| 916 | + else if ($type == 'comment' && $user->uid != $object->uid && $object->uid != 0 && user_access('ignore user')) { |
|
| 917 | 917 | if (!isset($ignored[$object->uid])) { |
| 918 | - $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid)); |
|
| 918 | + $ignored[$object->uid] = db_result(db_query('SELECT COUNT(*) FROM {ignore_user} WHERE uid = %d AND iuid = %d', $user->uid, $object->uid)); |
|
| 919 | 919 | } |
| 920 | 920 | if ($ignored[$object->uid] == 0) { |
| 921 | - $links['ignore_user'] = array( |
|
| 921 | + $links['ignore_user'] = array( |
|
| 922 | 922 | 'title' => bts('Ignore user', array(), NULL, 'boinc:ignore-user-add'), |
| 923 | 923 | 'href' => 'account/prefs/privacy/ignore_user/add/'. $object->uid, |
| 924 | 924 | 'query' => 'destination='. $_GET['q'], |
| 925 | 925 | 'attributes' => array( |
| 926 | - 'class' => 'ignore-user', |
|
| 927 | - 'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'), |
|
| 926 | + 'class' => 'ignore-user', |
|
| 927 | + 'title' => bts('Add user to your ignore list', array(), NULL, 'boinc:ignore-user-add'), |
|
| 928 | 928 | ), |
| 929 | - ); |
|
| 929 | + ); |
|
| 930 | + } |
|
| 930 | 931 | } |
| 931 | - } |
|
| 932 | 932 | |
| 933 | - return $links; |
|
| 933 | + return $links; |
|
| 934 | 934 | } |
| 935 | 935 | \ No newline at end of file |
@@ -56,9 +56,9 @@ |
||
| 56 | 56 | "email_addr=previous_email_addr, previous_email_addr='', email_addr_change_time=0, passwd_hash='$database_passwd_hash', email_validated=0" |
| 57 | 57 | ); |
| 58 | 58 | $result = delete_token($userid, $token, TOKEN_TYPE_CHANGE_EMAIL); |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | } else { |
| 61 | - echo tra("Invalid token."); |
|
| 61 | + echo tra("Invalid token."); |
|
| 62 | 62 | } |
| 63 | 63 | } else { |
| 64 | 64 | echo tra("Invalid token."); |
@@ -44,9 +44,9 @@ |
||
| 44 | 44 | page_head(tra("Delete Account")); |
| 45 | 45 | |
| 46 | 46 | echo "<p>".tra("Thank you for verifying ownership of your account.")."</p>" |
| 47 | - ."<p>".tra("You can now delete your account by entering in your password below and clicking the \"Delete Account\" button.")."</p>" |
|
| 48 | - ."<p>".tra("As a reminder, your account <b>cannot be recovered</b> once you delete it.")."</p>" |
|
| 49 | - ."<br/>"; |
|
| 47 | + ."<p>".tra("You can now delete your account by entering in your password below and clicking the \"Delete Account\" button.")."</p>" |
|
| 48 | + ."<p>".tra("As a reminder, your account <b>cannot be recovered</b> once you delete it.")."</p>" |
|
| 49 | + ."<br/>"; |
|
| 50 | 50 | |
| 51 | 51 | form_start(secure_url_base()."delete_account_confirm.php", "post"); |
| 52 | 52 | form_input_hidden("token", $token); |
@@ -2,9 +2,9 @@ discard block |
||
| 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,70 +20,70 @@ discard block |
||
| 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 | - if (module_exists('ignore_user')) { |
|
| 61 | + ); |
|
| 62 | + if (module_exists('ignore_user')) { |
|
| 63 | 63 | $items['account/prefs/privacy/ignore_user/add'] = array( |
| 64 | - 'title' => 'Add from ignore list', |
|
| 65 | - 'description' => 'Add user that you with to ignore to your ignore list.', |
|
| 66 | - 'page callback' => 'boincwork_ignore_user_add_user', |
|
| 67 | - 'access callback' => 'user_access', |
|
| 68 | - 'access arguments' => array('ignore user'), |
|
| 69 | - 'type' => MENU_CALLBACK, |
|
| 64 | + 'title' => 'Add from ignore list', |
|
| 65 | + 'description' => 'Add user that you with to ignore to your ignore list.', |
|
| 66 | + 'page callback' => 'boincwork_ignore_user_add_user', |
|
| 67 | + 'access callback' => 'user_access', |
|
| 68 | + 'access arguments' => array('ignore user'), |
|
| 69 | + 'type' => MENU_CALLBACK, |
|
| 70 | 70 | ); |
| 71 | 71 | $items['account/prefs/privacy/ignore_user/remove'] = array( |
| 72 | - 'title' => 'Remove from ignore list', |
|
| 73 | - 'description' => 'Remove user from your ignore list.', |
|
| 74 | - 'page callback' => 'boincwork_ignore_user_remove_user', |
|
| 75 | - 'access callback' => 'user_access', |
|
| 76 | - 'access arguments' => array('ignore user'), |
|
| 77 | - 'type' => MENU_CALLBACK, |
|
| 72 | + 'title' => 'Remove from ignore list', |
|
| 73 | + 'description' => 'Remove user from your ignore list.', |
|
| 74 | + 'page callback' => 'boincwork_ignore_user_remove_user', |
|
| 75 | + 'access callback' => 'user_access', |
|
| 76 | + 'access arguments' => array('ignore user'), |
|
| 77 | + 'type' => MENU_CALLBACK, |
|
| 78 | 78 | ); |
| 79 | - }// endif module_exists |
|
| 80 | - $items['account/certs'] = array( |
|
| 79 | + }// endif module_exists |
|
| 80 | + $items['account/certs'] = array( |
|
| 81 | 81 | 'title' =>'Account certificate', |
| 82 | 82 | 'page callback' => 'boincwork_certificates', |
| 83 | 83 | 'access arguments' => array('access content'), |
| 84 | 84 | 'type' => MENU_CALLBACK |
| 85 | - ); |
|
| 86 | - $items['admin/boinc/prefs/general'] = array( |
|
| 85 | + ); |
|
| 86 | + $items['admin/boinc/prefs/general'] = array( |
|
| 87 | 87 | 'title' => 'Preferences: General', |
| 88 | 88 | 'description' => 'Set options for BOINC preference set pages', |
| 89 | 89 | 'page callback' => 'drupal_get_form', |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | 'access arguments' => array('administer site configuration'), |
| 92 | 92 | 'type' => MENU_NORMAL_ITEM, |
| 93 | 93 | 'file' => 'boincwork.admin.inc' |
| 94 | - ); |
|
| 95 | - $items['admin/boinc/prefs/presets'] = array( |
|
| 94 | + ); |
|
| 95 | + $items['admin/boinc/prefs/presets'] = array( |
|
| 96 | 96 | 'title' => 'Preferences: Presets', |
| 97 | 97 | 'description' => 'Set values for BOINC preference set presets.', |
| 98 | 98 | 'page callback' => 'boincwork_admin_prefs_presets_page', |
| 99 | 99 | 'access arguments' => array('administer site configuration'), |
| 100 | 100 | 'type' => MENU_NORMAL_ITEM, |
| 101 | 101 | 'file' => 'boincwork.admin.inc' |
| 102 | - ); |
|
| 103 | - $items['admin/boinc/prefs/upload'] = array( |
|
| 102 | + ); |
|
| 103 | + $items['admin/boinc/prefs/upload'] = array( |
|
| 104 | 104 | 'title' => 'Preferences: Project-specific XML upload', |
| 105 | 105 | 'description' => 'Upload XML configuration for project specific preferences.', |
| 106 | 106 | 'page callback' => 'drupal_get_form', |
@@ -108,153 +108,153 @@ discard block |
||
| 108 | 108 | 'access arguments' => array('administer site configuration'), |
| 109 | 109 | 'type' => MENU_NORMAL_ITEM, |
| 110 | 110 | 'file' => 'boincwork.admin.inc' |
| 111 | - ); |
|
| 112 | - $items['host/%/delete'] = array( |
|
| 111 | + ); |
|
| 112 | + $items['host/%/delete'] = array( |
|
| 113 | 113 | 'title' => 'Delete host', |
| 114 | 114 | 'page callback' => 'boincwork_host_delete', |
| 115 | 115 | 'page arguments' => array(1), |
| 116 | 116 | 'access callback' => 'user_is_logged_in', |
| 117 | 117 | 'type' => MENU_CALLBACK, |
| 118 | - ); |
|
| 119 | - $items['host/%/log'] = array( |
|
| 118 | + ); |
|
| 119 | + $items['host/%/log'] = array( |
|
| 120 | 120 | 'title' => 'Host log', |
| 121 | 121 | 'page callback' => 'boincwork_host_log', |
| 122 | 122 | 'page arguments' => array(1), |
| 123 | 123 | 'access callback' => 'user_is_logged_in', |
| 124 | 124 | 'type' => MENU_CALLBACK, |
| 125 | - ); |
|
| 126 | - $items['host/%/merge'] = array( |
|
| 125 | + ); |
|
| 126 | + $items['host/%/merge'] = array( |
|
| 127 | 127 | 'title' => 'Merge computer', |
| 128 | 128 | 'page callback' => 'drupal_get_form', |
| 129 | 129 | 'page arguments' => array('boincwork_host_merge_form', 1), |
| 130 | 130 | 'access callback' => 'user_is_logged_in', |
| 131 | 131 | 'type' => MENU_CALLBACK, |
| 132 | - ); |
|
| 133 | - $items['host/%/set-venue/%'] = array( |
|
| 132 | + ); |
|
| 133 | + $items['host/%/set-venue/%'] = array( |
|
| 134 | 134 | 'title' => 'Set host venue', |
| 135 | 135 | 'page callback' => 'boincwork_host_set_venue', |
| 136 | 136 | 'page arguments' => array(1,3), |
| 137 | 137 | 'access callback' => 'user_is_logged_in', |
| 138 | 138 | 'type' => MENU_CALLBACK, |
| 139 | - ); |
|
| 140 | - $items['user/%/mobile'] = array( |
|
| 139 | + ); |
|
| 140 | + $items['user/%/mobile'] = array( |
|
| 141 | 141 | 'title' => 'Mobile stats', |
| 142 | 142 | 'page callback' => 'boincwork_mobile_stats', |
| 143 | 143 | 'page arguments' => array(1), |
| 144 | 144 | 'access callback' => 'user_is_logged_in', |
| 145 | 145 | 'type' => MENU_CALLBACK |
| 146 | - ); |
|
| 147 | - $items['server_status.php'] = array( |
|
| 146 | + ); |
|
| 147 | + $items['server_status.php'] = array( |
|
| 148 | 148 | 'title' => 'Server status', |
| 149 | 149 | 'page callback' => 'boincwork_server_status', |
| 150 | 150 | 'access arguments' => array('access content'), |
| 151 | 151 | 'type' => MENU_CALLBACK |
| 152 | - ); |
|
| 153 | - $items['job_file.php'] = array( |
|
| 152 | + ); |
|
| 153 | + $items['job_file.php'] = array( |
|
| 154 | 154 | 'title' => 'Job file input', |
| 155 | 155 | 'page callback' => 'boincwork_job_file', |
| 156 | 156 | 'access arguments' => array('access content'), |
| 157 | 157 | 'type' => MENU_CALLBACK |
| 158 | - ); |
|
| 159 | - $items['get_output.php'] = array( |
|
| 158 | + ); |
|
| 159 | + $items['get_output.php'] = array( |
|
| 160 | 160 | 'title' => 'Get output file', |
| 161 | 161 | 'page callback' => 'boincwork_get_output', |
| 162 | 162 | 'access arguments' => array('access content'), |
| 163 | 163 | 'type' => MENU_CALLBACK |
| 164 | - ); |
|
| 165 | - $items['get_project_config.php'] = array( |
|
| 164 | + ); |
|
| 165 | + $items['get_project_config.php'] = array( |
|
| 166 | 166 | 'title' => 'Project config', |
| 167 | 167 | 'page callback' => 'boincwork_get_project_config', |
| 168 | 168 | 'access arguments' => array('access content'), |
| 169 | 169 | 'type' => MENU_CALLBACK |
| 170 | - ); |
|
| 171 | - $items['submit_rpc_handler.php'] = array( |
|
| 170 | + ); |
|
| 171 | + $items['submit_rpc_handler.php'] = array( |
|
| 172 | 172 | 'title' => 'Remote job submission', |
| 173 | 173 | 'page callback' => 'boincwork_submit_rpc_handler', |
| 174 | 174 | 'access arguments' => array('access content'), |
| 175 | 175 | 'type' => MENU_CALLBACK |
| 176 | - ); |
|
| 177 | - $items['userw.php'] = array( |
|
| 176 | + ); |
|
| 177 | + $items['userw.php'] = array( |
|
| 178 | 178 | 'title' => 'User WAP', |
| 179 | 179 | 'page callback' => 'boincwork_user_wap', |
| 180 | 180 | 'access arguments' => array('access content'), |
| 181 | 181 | 'type' => MENU_CALLBACK |
| 182 | - ); |
|
| 183 | - $items['account/tasks/%/%'] = array( |
|
| 182 | + ); |
|
| 183 | + $items['account/tasks/%/%'] = array( |
|
| 184 | 184 | 'title' => 'Account Tasks Table', |
| 185 | 185 | 'description' => '', |
| 186 | 186 | 'page callback' => 'boincwork_account_task_table', |
| 187 | 187 | 'page arguments' => array(2,3), |
| 188 | 188 | 'access arguments' => array('access content'), |
| 189 | 189 | 'type' => MENU_CALLBACK, |
| 190 | - ); |
|
| 191 | - $items['host/%/tasks/%/%'] = array( |
|
| 190 | + ); |
|
| 191 | + $items['host/%/tasks/%/%'] = array( |
|
| 192 | 192 | 'title' => 'Host Tasks Table', |
| 193 | 193 | 'description' => '', |
| 194 | 194 | 'page callback' => 'boincwork_host_task_table', |
| 195 | 195 | 'page arguments' => array(1,3,4), |
| 196 | 196 | 'access arguments' => array('access content'), |
| 197 | 197 | 'type' => MENU_CALLBACK, |
| 198 | - ); |
|
| 199 | - // Workunit task table disabled |
|
| 200 | - //$items['workunit/%/tasks/%/%'] = array( |
|
| 201 | - // 'title' => 'Workunit Tasks Table', |
|
| 202 | - // 'description' => '', |
|
| 203 | - // 'page callback' => 'boincwork_workunit_task_table', |
|
| 204 | - // 'page arguments' => array(1,3,4), |
|
| 205 | - // 'access arguments' => array('access content'), |
|
| 206 | - // 'type' => MENU_CALLBACK, |
|
| 207 | - //); |
|
| 208 | - return $items; |
|
| 198 | + ); |
|
| 199 | + // Workunit task table disabled |
|
| 200 | + //$items['workunit/%/tasks/%/%'] = array( |
|
| 201 | + // 'title' => 'Workunit Tasks Table', |
|
| 202 | + // 'description' => '', |
|
| 203 | + // 'page callback' => 'boincwork_workunit_task_table', |
|
| 204 | + // 'page arguments' => array(1,3,4), |
|
| 205 | + // 'access arguments' => array('access content'), |
|
| 206 | + // 'type' => MENU_CALLBACK, |
|
| 207 | + //); |
|
| 208 | + return $items; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | 212 | * Implementation of hook_theme(). |
| 213 | 213 | */ |
| 214 | 214 | function boincwork_theme() { |
| 215 | - return array( |
|
| 215 | + return array( |
|
| 216 | 216 | 'boincwork_privacyprefs_form' => array( |
| 217 | - 'arguments' => array('form'), |
|
| 217 | + 'arguments' => array('form'), |
|
| 218 | 218 | ), |
| 219 | - ); |
|
| 219 | + ); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * Implementation of hook_views_api(). |
| 224 | 224 | */ |
| 225 | 225 | function boincwork_views_api() { |
| 226 | - return array( |
|
| 226 | + return array( |
|
| 227 | 227 | 'api' => 2.0, |
| 228 | 228 | 'path' => drupal_get_path('module', 'boincwork') |
| 229 | - ); |
|
| 229 | + ); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | 233 | * Implementation of hook_locale(). |
| 234 | 234 | */ |
| 235 | 235 | function boincwork_locale($op = 'groups', $group = NULL) { |
| 236 | - switch ($op) { |
|
| 236 | + switch ($op) { |
|
| 237 | 237 | case 'groups': |
| 238 | 238 | return array('project' => bts('Project')); |
| 239 | 239 | case 'info': |
| 240 | 240 | $info['project']['refresh callback'] = 'boincwork_locale_refresh'; |
| 241 | - $info['project']['format'] = FALSE; |
|
| 242 | - return $info; |
|
| 243 | - } |
|
| 241 | + $info['project']['format'] = FALSE; |
|
| 242 | + return $info; |
|
| 243 | + } |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | 247 | * Refresh strings. |
| 248 | 248 | */ |
| 249 | 249 | function boincwork_locale_refresh() { |
| 250 | - // Mimic process of adding project specific prefs to the project preferences |
|
| 251 | - // form -- this parses the prefs XML and calls i18nstrings_update() |
|
| 252 | - $form = array(); |
|
| 253 | - $prefs = array( |
|
| 250 | + // Mimic process of adding project specific prefs to the project preferences |
|
| 251 | + // form -- this parses the prefs XML and calls i18nstrings_update() |
|
| 252 | + $form = array(); |
|
| 253 | + $prefs = array( |
|
| 254 | 254 | 'project_specific' => array(), |
| 255 | - ); |
|
| 256 | - boincwork_add_project_specific_prefs($form, $prefs); |
|
| 257 | - return TRUE; // Meaning it completed with no issues |
|
| 255 | + ); |
|
| 256 | + boincwork_add_project_specific_prefs($form, $prefs); |
|
| 257 | + return TRUE; // Meaning it completed with no issues |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -263,43 +263,43 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | |
| 265 | 265 | function boincwork_privatemsg_message_view_alter(&$vars) { |
| 266 | - global $user; |
|
| 266 | + global $user; |
|
| 267 | 267 | |
| 268 | - $author = $vars['message']['author']; |
|
| 269 | - if (!isset($vars['message']['thread_id'])) { |
|
| 268 | + $author = $vars['message']['author']; |
|
| 269 | + if (!isset($vars['message']['thread_id'])) { |
|
| 270 | 270 | // No thread id, this is probably only a preview |
| 271 | 271 | return; |
| 272 | - } |
|
| 273 | - $thread_id = $vars['message']['thread_id']; |
|
| 272 | + } |
|
| 273 | + $thread_id = $vars['message']['thread_id']; |
|
| 274 | 274 | |
| 275 | - if ($user->uid != $author->uid) { |
|
| 275 | + if ($user->uid != $author->uid) { |
|
| 276 | 276 | if ($vars['message']['is_blocked']) { |
| 277 | - $vars['message_actions']['unignore_user'] = array( |
|
| 277 | + $vars['message_actions']['unignore_user'] = array( |
|
| 278 | 278 | 'title' => bts('Stop Ignoring User', array(), NULL, 'boinc:ignore-user-remove'), |
| 279 | 279 | 'href' => 'account/prefs/privacy/ignore_user/remove/'. $author->uid, |
| 280 | 280 | 'query' => 'destination=messages/view/' . $thread_id, |
| 281 | - ); |
|
| 281 | + ); |
|
| 282 | 282 | } |
| 283 | 283 | else { |
| 284 | - $vars['message_actions']['ignore_user'] = array( |
|
| 284 | + $vars['message_actions']['ignore_user'] = array( |
|
| 285 | 285 | 'title' => bts('Ignore User', array(), NULL, 'boinc:ignore-user-add'), |
| 286 | 286 | 'href' => 'account/prefs/privacy/ignore_user/add/'. $author->uid, |
| 287 | 287 | 'query' => 'destination=messages/view/' . $thread_id, |
| 288 | - ); |
|
| 288 | + ); |
|
| 289 | + } |
|
| 289 | 290 | } |
| 290 | - } |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | 294 | * Implementation of hook_cron() |
| 295 | 295 | */ |
| 296 | 296 | function boincwork_cron() { |
| 297 | - // Delete expired hosts in the BOINC database, host_delete table. |
|
| 298 | - require_boinc('boinc_db'); |
|
| 299 | - $num_deleted = BoincHostDeleted::delete_expired(); |
|
| 300 | - if ($num_deleted>0) { |
|
| 297 | + // Delete expired hosts in the BOINC database, host_delete table. |
|
| 298 | + require_boinc('boinc_db'); |
|
| 299 | + $num_deleted = BoincHostDeleted::delete_expired(); |
|
| 300 | + if ($num_deleted>0) { |
|
| 301 | 301 | watchdog('boincwork', "Deleted ${num_deleted} hosts from host_deleted table", WATCHDOG_NOTICE); |
| 302 | - } |
|
| 302 | + } |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -307,41 +307,41 @@ discard block |
||
| 307 | 307 | * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
| 308 | 308 | |
| 309 | 309 | /** |
| 310 | - * General preferences menu callback. |
|
| 311 | - * Called when user goes to edit preferences page |
|
| 312 | - */ |
|
| 310 | + * General preferences menu callback. |
|
| 311 | + * Called when user goes to edit preferences page |
|
| 312 | + */ |
|
| 313 | 313 | function generalprefs_page($action = null, $venue = null, $advanced = FALSE) { |
| 314 | 314 | |
| 315 | - // Keep the venue selected across preference pages |
|
| 316 | - boincwork_select_venue($venue); |
|
| 315 | + // Keep the venue selected across preference pages |
|
| 316 | + boincwork_select_venue($venue); |
|
| 317 | 317 | |
| 318 | - $pref_sets = array('generic', 'home', 'school', 'work'); |
|
| 319 | - $output = null; |
|
| 320 | - // Set the page title |
|
| 321 | - $title = 'Computing'; |
|
| 322 | - drupal_set_title($title); |
|
| 318 | + $pref_sets = array('generic', 'home', 'school', 'work'); |
|
| 319 | + $output = null; |
|
| 320 | + // Set the page title |
|
| 321 | + $title = 'Computing'; |
|
| 322 | + drupal_set_title($title); |
|
| 323 | 323 | |
| 324 | - switch ($action) { |
|
| 324 | + switch ($action) { |
|
| 325 | 325 | |
| 326 | - case 'clear': |
|
| 326 | + case 'clear': |
|
| 327 | 327 | // Remove settings from this preference set |
| 328 | 328 | if ($venue AND $venue != 'generic') { |
| 329 | - boincwork_save_prefs(NULL, 'general', $venue); |
|
| 330 | - drupal_set_message(t('Settings for the "@name" preference set have been |
|
| 329 | + boincwork_save_prefs(NULL, 'general', $venue); |
|
| 330 | + drupal_set_message(t('Settings for the "@name" preference set have been |
|
| 331 | 331 | cleared', array('@name' => ucfirst($venue)))); |
| 332 | - // Set the generic preference set as active |
|
| 333 | - $_SESSION['prefs venue'] = 'generic'; |
|
| 332 | + // Set the generic preference set as active |
|
| 333 | + $_SESSION['prefs venue'] = 'generic'; |
|
| 334 | 334 | } |
| 335 | 335 | drupal_goto(); |
| 336 | 336 | break; |
| 337 | 337 | |
| 338 | - case 'combined': |
|
| 338 | + case 'combined': |
|
| 339 | 339 | // Compare preference sets; tabular view |
| 340 | 340 | |
| 341 | 341 | foreach ($pref_sets as $pref_set) { |
| 342 | - $form_state = array(); |
|
| 343 | - $prefs[$pref_set] = drupal_retrieve_form('boincwork_generalprefs_form', $form_state, $pref_set); |
|
| 344 | - drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state); |
|
| 342 | + $form_state = array(); |
|
| 343 | + $prefs[$pref_set] = drupal_retrieve_form('boincwork_generalprefs_form', $form_state, $pref_set); |
|
| 344 | + drupal_prepare_form('boincwork_generalprefs_form', $prefs[$pref_set], $form_state); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | $output .= '<p>' . bts('These apply to all BOINC projects in which you participate.', array(), NULL, 'boinc:account-preferences-computing') . '<br/>'; |
@@ -354,29 +354,29 @@ discard block |
||
| 354 | 354 | $prefs_table = boincwork_make_prefs_table($prefs['generic']['prefs']['advanced']); |
| 355 | 355 | |
| 356 | 356 | foreach ($prefs_table as $category => $section) { |
| 357 | - $output .= '<tr class="section-heading">'; |
|
| 358 | - $output .= "<td>{$section['name']}</td>"; |
|
| 359 | - foreach ($pref_sets as $pref_set) { |
|
| 357 | + $output .= '<tr class="section-heading">'; |
|
| 358 | + $output .= "<td>{$section['name']}</td>"; |
|
| 359 | + foreach ($pref_sets as $pref_set) { |
|
| 360 | 360 | $output .= '<td>' . $pref_set . '</td>'; |
| 361 | - } |
|
| 362 | - $output .= '</tr>'; |
|
| 363 | - foreach ($section['elements'] as $name => $setting) { |
|
| 361 | + } |
|
| 362 | + $output .= '</tr>'; |
|
| 363 | + foreach ($section['elements'] as $name => $setting) { |
|
| 364 | 364 | // Output the setting name and description, with an ugly exception |
| 365 | 365 | // made for preferences with special formatting |
| 366 | 366 | $special_map = array( |
| 367 | - 'start_hour' => 'end_hour', |
|
| 368 | - 'net_start_hour'=> 'net_end_hour', |
|
| 369 | - 'daily_xfer_limit_mb' => 'daily_xfer_period_days', |
|
| 367 | + 'start_hour' => 'end_hour', |
|
| 368 | + 'net_start_hour'=> 'net_end_hour', |
|
| 369 | + 'daily_xfer_limit_mb' => 'daily_xfer_period_days', |
|
| 370 | 370 | ); |
| 371 | 371 | $special_delimiter = array( |
| 372 | - 'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'), |
|
| 373 | - 'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'), |
|
| 374 | - 'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'), |
|
| 372 | + 'start_hour' => bts('and', array(), NULL, 'boinc:account-preference'), |
|
| 373 | + 'net_start_hour'=> bts('and', array(), NULL, 'boinc:account-preference'), |
|
| 374 | + 'daily_xfer_limit_mb' => bts('every', array(), NULL, 'boinc:account-preference'), |
|
| 375 | 375 | ); |
| 376 | 376 | $special = isset($special_map[$name]); |
| 377 | 377 | $very_special = in_array($name, $special_map); |
| 378 | 378 | if ($very_special) { |
| 379 | - continue; |
|
| 379 | + continue; |
|
| 380 | 380 | } |
| 381 | 381 | $output .= '<tr>'; |
| 382 | 382 | $output .= '<td>'; |
@@ -386,35 +386,35 @@ discard block |
||
| 386 | 386 | // Output values for each preference set, again with ugly hacks for |
| 387 | 387 | // time range preferences |
| 388 | 388 | foreach ($pref_sets as $pref_set) { |
| 389 | - if (($prefs[$pref_set]) AND |
|
| 389 | + if (($prefs[$pref_set]) AND |
|
| 390 | 390 | $prefs[$pref_set]['#established'] AND |
| 391 | 391 | isset($prefs[$pref_set]['prefs']['advanced'][$category])) { |
| 392 | 392 | $pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$name]; |
| 393 | 393 | $value = isset($pref_setting['#options']) ? $pref_setting['#options'][$pref_setting['#default_value']] : $pref_setting['#default_value']; |
| 394 | 394 | if ($value == '') { |
| 395 | - $value = '---'; |
|
| 395 | + $value = '---'; |
|
| 396 | 396 | } |
| 397 | 397 | if (!isset($pref_setting['#field_suffix'])) { |
| 398 | - $pref_setting['#field_suffix'] = ''; |
|
| 398 | + $pref_setting['#field_suffix'] = ''; |
|
| 399 | 399 | } |
| 400 | 400 | if (!$special) { |
| 401 | - $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
|
| 401 | + $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
|
| 402 | 402 | } |
| 403 | 403 | else { |
| 404 | - // The "very special" case where we merge two prefs |
|
| 405 | - $second_pref = $special_map[$name]; |
|
| 406 | - $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
|
| 407 | - $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value']; |
|
| 408 | - $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
|
| 404 | + // The "very special" case where we merge two prefs |
|
| 405 | + $second_pref = $special_map[$name]; |
|
| 406 | + $second_pref_setting = $prefs[$pref_set]['prefs']['advanced'][$category][$second_pref]; |
|
| 407 | + $second_value = isset($second_pref_setting['#options']) ? $second_pref_setting['#options'][$second_pref_setting['#default_value']] : $second_pref_setting['#default_value']; |
|
| 408 | + $output .= "<td>{$value} {$pref_setting['#field_suffix']} {$special_delimiter[$name]}" . |
|
| 409 | 409 | " {$second_value} {$second_pref_setting['#field_suffix']} </td>"; |
| 410 | 410 | } |
| 411 | - } |
|
| 412 | - else { |
|
| 411 | + } |
|
| 412 | + else { |
|
| 413 | 413 | $output .= '<td>---</td>'; |
| 414 | - } |
|
| 414 | + } |
|
| 415 | 415 | } |
| 416 | 416 | $output .= '</tr>'; |
| 417 | - } |
|
| 417 | + } |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // Empty line above action links... :/ |
@@ -430,24 +430,24 @@ discard block |
||
| 430 | 430 | $output .= '<tr>'; |
| 431 | 431 | $output .= '<td></td>'; |
| 432 | 432 | foreach ($pref_sets as $pref_set) { |
| 433 | - $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
| 434 | - $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
| 435 | - $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1", |
|
| 433 | + $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
| 434 | + $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
| 435 | + $output .= l($action_text, "account/prefs/computing/edit/{$pref_set}/1", |
|
| 436 | 436 | array('fragment' => "") |
| 437 | - ); |
|
| 438 | - // Show Clear links for established preference sets |
|
| 439 | - if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
| 437 | + ); |
|
| 438 | + // Show Clear links for established preference sets |
|
| 439 | + if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
| 440 | 440 | $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/computing/clear/{$pref_set}", |
| 441 | - array( |
|
| 441 | + array( |
|
| 442 | 442 | 'query' => drupal_get_destination(), |
| 443 | 443 | 'attributes' => array( |
| 444 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 444 | + 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 445 | 445 | array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-computing-preferences') . '\')' |
| 446 | 446 | ) |
| 447 | - ) |
|
| 447 | + ) |
|
| 448 | 448 | ); |
| 449 | - } |
|
| 450 | - $output .= '</li></ul></td>'; |
|
| 449 | + } |
|
| 450 | + $output .= '</li></ul></td>'; |
|
| 451 | 451 | } |
| 452 | 452 | $output .= '</tr>'; |
| 453 | 453 | |
@@ -455,28 +455,28 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | break; |
| 457 | 457 | |
| 458 | - case 'edit': |
|
| 458 | + case 'edit': |
|
| 459 | 459 | default: |
| 460 | 460 | |
| 461 | 461 | // Return the HTML generated from the $form data structure. |
| 462 | 462 | if (function_exists('jump_quickly')) { |
| 463 | - $path = 'account/prefs/computing/edit'; |
|
| 464 | - $venues = array( |
|
| 463 | + $path = 'account/prefs/computing/edit'; |
|
| 464 | + $venues = array( |
|
| 465 | 465 | "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'), |
| 466 | 466 | "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'), |
| 467 | 467 | "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'), |
| 468 | 468 | "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location') |
| 469 | - ); |
|
| 470 | - variable_set('jump_use_js_venues-Array', 1); |
|
| 471 | - drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
| 472 | - drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
| 469 | + ); |
|
| 470 | + variable_set('jump_use_js_venues-Array', 1); |
|
| 471 | + drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
| 472 | + drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
| 473 | 473 | |
| 474 | - $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
| 475 | - $output .= ' <div class="form-item venue">'; |
|
| 476 | - $output .= ' <label>Preference set:</label>'; |
|
| 477 | - $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
| 478 | - $output .= ' </div>'; |
|
| 479 | - $output .= '</div>'; |
|
| 474 | + $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
| 475 | + $output .= ' <div class="form-item venue">'; |
|
| 476 | + $output .= ' <label>Preference set:</label>'; |
|
| 477 | + $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
| 478 | + $output .= ' </div>'; |
|
| 479 | + $output .= '</div>'; |
|
| 480 | 480 | } |
| 481 | 481 | $output .= drupal_get_form('boincwork_generalprefs_form', $venue, NULL, $advanced); |
| 482 | 482 | |
@@ -487,54 +487,54 @@ discard block |
||
| 487 | 487 | drupal_prepare_form('boincwork_generalprefs_form', $current_set, $form_state); |
| 488 | 488 | |
| 489 | 489 | if (!$current_set['#established']) { |
| 490 | - drupal_set_message(bts( |
|
| 491 | - "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
| 492 | - array( '@venue' => $venue, ), |
|
| 493 | - NULL, 'boinc:account-preferences'), 'status'); |
|
| 490 | + drupal_set_message(bts( |
|
| 491 | + "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
| 492 | + array( '@venue' => $venue, ), |
|
| 493 | + NULL, 'boinc:account-preferences'), 'status'); |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | break; |
| 497 | - } |
|
| 497 | + } |
|
| 498 | 498 | |
| 499 | - return $output; |
|
| 499 | + return $output; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | /** |
| 503 | - * Project preferences menu callback |
|
| 504 | - * Called when user goes to edit project preferences page. |
|
| 505 | - */ |
|
| 503 | + * Project preferences menu callback |
|
| 504 | + * Called when user goes to edit project preferences page. |
|
| 505 | + */ |
|
| 506 | 506 | function projectprefs_page($action = null, $venue = null) { |
| 507 | 507 | |
| 508 | - // Keep the venue selected across preference pages |
|
| 509 | - boincwork_select_venue($venue); |
|
| 508 | + // Keep the venue selected across preference pages |
|
| 509 | + boincwork_select_venue($venue); |
|
| 510 | 510 | |
| 511 | - require_boinc(array('util', 'prefs')); |
|
| 512 | - global $project_has_beta; |
|
| 513 | - $pref_sets = array('generic', 'home', 'school', 'work'); |
|
| 514 | - $output = null; |
|
| 511 | + require_boinc(array('util', 'prefs')); |
|
| 512 | + global $project_has_beta; |
|
| 513 | + $pref_sets = array('generic', 'home', 'school', 'work'); |
|
| 514 | + $output = null; |
|
| 515 | 515 | |
| 516 | - $title = 'Project'; |
|
| 517 | - drupal_set_title($title); |
|
| 516 | + $title = 'Project'; |
|
| 517 | + drupal_set_title($title); |
|
| 518 | 518 | |
| 519 | - switch ($action) { |
|
| 519 | + switch ($action) { |
|
| 520 | 520 | |
| 521 | - case 'clear': |
|
| 521 | + case 'clear': |
|
| 522 | 522 | // Remove settings from this preference set |
| 523 | 523 | if ($venue AND $venue != 'generic') { |
| 524 | - boincwork_save_prefs(NULL, 'project', $venue); |
|
| 525 | - drupal_set_message(t('Settings for the "@name" preference set have been |
|
| 524 | + boincwork_save_prefs(NULL, 'project', $venue); |
|
| 525 | + drupal_set_message(t('Settings for the "@name" preference set have been |
|
| 526 | 526 | cleared', array('@name' => ucfirst($venue)))); |
| 527 | 527 | |
| 528 | - // Set the generic preference set as active |
|
| 529 | - $_SESSION['prefs venue'] = 'generic'; |
|
| 528 | + // Set the generic preference set as active |
|
| 529 | + $_SESSION['prefs venue'] = 'generic'; |
|
| 530 | 530 | |
| 531 | - // If the user has removed their default preference set, make it generic |
|
| 532 | - boincwork_set_default_venue(); |
|
| 531 | + // If the user has removed their default preference set, make it generic |
|
| 532 | + boincwork_set_default_venue(); |
|
| 533 | 533 | } |
| 534 | 534 | drupal_goto(); |
| 535 | 535 | break; |
| 536 | 536 | |
| 537 | - case 'combined': |
|
| 537 | + case 'combined': |
|
| 538 | 538 | |
| 539 | 539 | // Compare preference sets; tabular view |
| 540 | 540 | |
@@ -543,9 +543,9 @@ discard block |
||
| 543 | 543 | $boincuser = BoincUser::lookup_id($account->boincuser_id); |
| 544 | 544 | |
| 545 | 545 | foreach ($pref_sets as $pref_set) { |
| 546 | - $form_state = array(); |
|
| 547 | - $prefs[$pref_set] = drupal_retrieve_form('boincwork_projectprefs_form', $form_state, $pref_set); |
|
| 548 | - drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state); |
|
| 546 | + $form_state = array(); |
|
| 547 | + $prefs[$pref_set] = drupal_retrieve_form('boincwork_projectprefs_form', $form_state, $pref_set); |
|
| 548 | + drupal_prepare_form('boincwork_projectprefs_form', $prefs[$pref_set], $form_state); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | $output .= '<p>' . bts('Preferences last modified: @mod_time', array('@mod_time' => pretty_time_str($prefs['generic']['modified']['#value'])), NULL, 'boinc:account-preferences') . '</p>'; |
@@ -556,20 +556,20 @@ discard block |
||
| 556 | 556 | $prefs_table = boincwork_make_prefs_table($prefs['generic']); |
| 557 | 557 | |
| 558 | 558 | foreach ($prefs_table as $category => $section) { |
| 559 | - $output .= '<tr class="section-heading">'; |
|
| 560 | - $output .= "<td>{$section['name']}</td>"; |
|
| 561 | - foreach ($pref_sets as $pref_set) { |
|
| 559 | + $output .= '<tr class="section-heading">'; |
|
| 560 | + $output .= "<td>{$section['name']}</td>"; |
|
| 561 | + foreach ($pref_sets as $pref_set) { |
|
| 562 | 562 | $output .= '<td>' . $pref_set . '</td>'; |
| 563 | - } |
|
| 564 | - $output .= '</tr>'; |
|
| 565 | - foreach ($section['elements'] as $name => $setting) { |
|
| 563 | + } |
|
| 564 | + $output .= '</tr>'; |
|
| 565 | + foreach ($section['elements'] as $name => $setting) { |
|
| 566 | 566 | $output .= '<tr>'; |
| 567 | 567 | $output .= '<td>'; |
| 568 | 568 | $output .= "<div class=\"title\">{$setting['name']}</div>"; |
| 569 | 569 | $output .= "<div class=\"description\">{$setting['description']}</div>"; |
| 570 | 570 | $output .= '</td>'; |
| 571 | 571 | foreach ($pref_sets as $pref_set) { |
| 572 | - if (($prefs[$pref_set]) AND |
|
| 572 | + if (($prefs[$pref_set]) AND |
|
| 573 | 573 | $prefs[$pref_set]['#established'] AND |
| 574 | 574 | isset($prefs[$pref_set][$category])) { |
| 575 | 575 | $pref_setting = $prefs[$pref_set][$category][$name]; |
@@ -577,10 +577,10 @@ discard block |
||
| 577 | 577 | if ($value == '') $value = '---'; |
| 578 | 578 | if (!isset($pref_setting['#field_suffix'])) $pref_setting['#field_suffix'] = ''; |
| 579 | 579 | $output .= "<td>{$value} {$pref_setting['#field_suffix']}</td>"; |
| 580 | - } else $output .= '<td>---</td>'; |
|
| 580 | + } else $output .= '<td>---</td>'; |
|
| 581 | 581 | } |
| 582 | 582 | $output .= '</tr>'; |
| 583 | - } |
|
| 583 | + } |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | // Empty line above action links... :/ |
@@ -596,29 +596,29 @@ discard block |
||
| 596 | 596 | $output .= '<tr>'; |
| 597 | 597 | $output .= '<td></td>'; |
| 598 | 598 | foreach ($pref_sets as $pref_set) { |
| 599 | - $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
| 600 | - $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
| 601 | - $output .= l($action_text, "account/prefs/project/edit/{$pref_set}"); |
|
| 602 | - // Show Clear links for established preference sets |
|
| 603 | - if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
| 599 | + $action_text = ($prefs[$pref_set]['#established']) ? bts('Edit', array(), NULL, 'boinc:form-edit') : bts('Add', array(), NULL, 'boinc:form-add'); |
|
| 600 | + $output .= '<td><ul class="tab-list"><li class="first tab">'; |
|
| 601 | + $output .= l($action_text, "account/prefs/project/edit/{$pref_set}"); |
|
| 602 | + // Show Clear links for established preference sets |
|
| 603 | + if ($pref_set != 'generic' AND $prefs[$pref_set]['#established']) { |
|
| 604 | 604 | $output .= ' </li><li class="tab"> ' . l(bts('Clear', array(), NULL, 'boinc:form-clear'), "account/prefs/project/clear/{$pref_set}", |
| 605 | - array( |
|
| 605 | + array( |
|
| 606 | 606 | 'query' => drupal_get_destination(), |
| 607 | 607 | 'attributes' => array( |
| 608 | - 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 608 | + 'onclick' => 'return confirm(\'' . bts('This will remove all of your settings from the "@name" preference set. Are you sure?', |
|
| 609 | 609 | array('@name' => ucfirst($pref_set)), NULL, 'boinc:account-preferences-project') . '\')' |
| 610 | 610 | ) |
| 611 | - ) |
|
| 611 | + ) |
|
| 612 | 612 | ); |
| 613 | - } |
|
| 614 | - $output .= '</li></ul></td>'; |
|
| 613 | + } |
|
| 614 | + $output .= '</li></ul></td>'; |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | $output .= '</table>'; |
| 618 | 618 | |
| 619 | 619 | break; |
| 620 | 620 | |
| 621 | - case 'set-default': |
|
| 621 | + case 'set-default': |
|
| 622 | 622 | // Set this preference set as the one to use for any new hosts attached |
| 623 | 623 | // to the user account |
| 624 | 624 | boincwork_set_default_venue($venue); |
@@ -626,30 +626,30 @@ discard block |
||
| 626 | 626 | drupal_goto('account/prefs/project/combined'); |
| 627 | 627 | break; |
| 628 | 628 | |
| 629 | - case 'edit': |
|
| 629 | + case 'edit': |
|
| 630 | 630 | default: |
| 631 | 631 | |
| 632 | 632 | // Return the HTML generated from the $form data structure. |
| 633 | 633 | require_boinc('util'); |
| 634 | 634 | |
| 635 | 635 | if (function_exists('jump_quickly')) { |
| 636 | - $path = 'account/prefs/project/edit'; |
|
| 637 | - $venues = array( |
|
| 636 | + $path = 'account/prefs/project/edit'; |
|
| 637 | + $venues = array( |
|
| 638 | 638 | "{$path}/generic" => bts('Generic', array(), NULL, 'boinc:account-preferences-location'), |
| 639 | 639 | "{$path}/home" => bts('Home', array(), NULL, 'boinc:account-preferences-location:-1:ignoreoverwrite'), |
| 640 | 640 | "{$path}/school" => bts('School', array(), NULL, 'boinc:account-preferences-location'), |
| 641 | 641 | "{$path}/work" => bts('Work', array(), NULL, 'boinc:account-preferences-location') |
| 642 | - ); |
|
| 643 | - variable_set('jump_use_js_venues-Array', 1); |
|
| 644 | - drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
| 645 | - drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
| 642 | + ); |
|
| 643 | + variable_set('jump_use_js_venues-Array', 1); |
|
| 644 | + drupal_add_js(drupal_get_path('module', 'jump') . '/jump.js'); |
|
| 645 | + drupal_add_js(drupal_get_path('theme', 'boinc') . '/js/prefs.js', 'theme'); |
|
| 646 | 646 | |
| 647 | - $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
| 648 | - $output .= ' <div class="form-item venue">'; |
|
| 649 | - $output .= ' <label>Preference set:</label>'; |
|
| 650 | - $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
| 651 | - $output .= ' </div>'; |
|
| 652 | - $output .= '</div>'; |
|
| 647 | + $output .= '<div id="venue-selector" class="simple-form-controls">'; |
|
| 648 | + $output .= ' <div class="form-item venue">'; |
|
| 649 | + $output .= ' <label>Preference set:</label>'; |
|
| 650 | + $output .= jump_quickly($venues, 'venues', 1, "{$path}/{$venue}"); |
|
| 651 | + $output .= ' </div>'; |
|
| 652 | + $output .= '</div>'; |
|
| 653 | 653 | } |
| 654 | 654 | $output .= drupal_get_form('boincwork_projectprefs_form', $venue); |
| 655 | 655 | |
@@ -660,63 +660,63 @@ discard block |
||
| 660 | 660 | drupal_prepare_form('boincwork_projectprefs_form', $current_set, $form_state); |
| 661 | 661 | |
| 662 | 662 | if (!$current_set['#established']) { |
| 663 | - drupal_set_message(bts( |
|
| 664 | - "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
| 665 | - array( '@venue' => $venue, ), |
|
| 666 | - NULL, 'boinc:account-preferences'), 'status'); |
|
| 663 | + drupal_set_message(bts( |
|
| 664 | + "No preferences found for set '@venue'. Click SAVE CHANGES below to save the following preferences to your account.", |
|
| 665 | + array( '@venue' => $venue, ), |
|
| 666 | + NULL, 'boinc:account-preferences'), 'status'); |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | break; |
| 670 | 670 | |
| 671 | - } |
|
| 672 | - return $output; |
|
| 671 | + } |
|
| 672 | + return $output; |
|
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | /** |
| 676 | - * Community preferences menu callback |
|
| 677 | - * Called when user goes to edit community preferences page. |
|
| 678 | - */ |
|
| 676 | + * Community preferences menu callback |
|
| 677 | + * Called when user goes to edit community preferences page. |
|
| 678 | + */ |
|
| 679 | 679 | function communityprefs_page($action = null) { |
| 680 | 680 | |
| 681 | - require_boinc(array('util', 'prefs')); |
|
| 682 | - $output = null; |
|
| 681 | + require_boinc(array('util', 'prefs')); |
|
| 682 | + $output = null; |
|
| 683 | 683 | |
| 684 | - $title = 'Community'; |
|
| 685 | - drupal_set_title($title); |
|
| 684 | + $title = 'Community'; |
|
| 685 | + drupal_set_title($title); |
|
| 686 | 686 | |
| 687 | - //$output .= '<h2>Community preferences</h2>'; |
|
| 687 | + //$output .= '<h2>Community preferences</h2>'; |
|
| 688 | 688 | |
| 689 | - $output .= drupal_get_form('communityprefs_form'); |
|
| 689 | + $output .= drupal_get_form('communityprefs_form'); |
|
| 690 | 690 | |
| 691 | - return $output; |
|
| 691 | + return $output; |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | /** |
| 695 | - * Privacy preferences menu callback |
|
| 696 | - * Called when user goes to edit privacy preferences page. |
|
| 697 | - */ |
|
| 695 | + * Privacy preferences menu callback |
|
| 696 | + * Called when user goes to edit privacy preferences page. |
|
| 697 | + */ |
|
| 698 | 698 | function privacyprefs_page($action = null) { |
| 699 | 699 | |
| 700 | - require_boinc(array('util', 'prefs')); |
|
| 701 | - $output = null; |
|
| 702 | - $title = 'Privacy'; |
|
| 703 | - drupal_set_title($title); |
|
| 700 | + require_boinc(array('util', 'prefs')); |
|
| 701 | + $output = null; |
|
| 702 | + $title = 'Privacy'; |
|
| 703 | + drupal_set_title($title); |
|
| 704 | 704 | |
| 705 | - switch ($action) { |
|
| 706 | - case 'view': |
|
| 705 | + switch ($action) { |
|
| 706 | + case 'view': |
|
| 707 | 707 | $form_state = array(); |
| 708 | 708 | $prefs = drupal_retrieve_form('boincwork_privacyprefs_form', $form_state); |
| 709 | 709 | drupal_prepare_form('boincwork_privacyprefs_form', $prefs, $form_state); |
| 710 | 710 | $output .= '<table>'; |
| 711 | 711 | |
| 712 | 712 | $sections = array( |
| 713 | - 'privacy' => $prefs['privacy'] |
|
| 713 | + 'privacy' => $prefs['privacy'] |
|
| 714 | 714 | ); |
| 715 | 715 | |
| 716 | 716 | foreach ($sections as $section) { |
| 717 | - $output .= '<tr class="section-heading">'; |
|
| 718 | - $output .= "<td>{$section['#title']}</td></tr>"; |
|
| 719 | - foreach ($section as $name => $setting) { |
|
| 717 | + $output .= '<tr class="section-heading">'; |
|
| 718 | + $output .= "<td>{$section['#title']}</td></tr>"; |
|
| 719 | + foreach ($section as $name => $setting) { |
|
| 720 | 720 | if ($name{0} == '#') continue; |
| 721 | 721 | $value = isset($setting['#default_value']) ? $setting['#default_value'] : ''; |
| 722 | 722 | if ($value AND isset($setting['#options'])) $value = $setting['#options'][$value]; |
@@ -728,7 +728,7 @@ discard block |
||
| 728 | 728 | $output .= "<td>{$setting['#title']}<br/>{$setting['#description']}</td>"; |
| 729 | 729 | $output .= "<td>{$value} {$setting['#field_suffix']}</td>"; |
| 730 | 730 | $output .= '</tr>'; |
| 731 | - } |
|
| 731 | + } |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | // Edit preferences link |
@@ -741,33 +741,33 @@ discard block |
||
| 741 | 741 | |
| 742 | 742 | break; |
| 743 | 743 | |
| 744 | - case 'edit': |
|
| 744 | + case 'edit': |
|
| 745 | 745 | default: |
| 746 | 746 | require_boinc('util'); |
| 747 | 747 | // Return the HTML generated from the $form data structure. |
| 748 | 748 | $output .= drupal_get_form('boincwork_privacyprefs_form'); |
| 749 | 749 | break; |
| 750 | 750 | |
| 751 | - } |
|
| 751 | + } |
|
| 752 | 752 | |
| 753 | - return $output; |
|
| 753 | + return $output; |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | /** |
| 757 | - * Certificates menu callback |
|
| 758 | - * Called when user goes to account certificate pages |
|
| 759 | - */ |
|
| 757 | + * Certificates menu callback |
|
| 758 | + * Called when user goes to account certificate pages |
|
| 759 | + */ |
|
| 760 | 760 | function boincwork_certificates($type = null, $border = null) { |
| 761 | - global $user; |
|
| 762 | - $drupuser = user_load($user->uid); |
|
| 763 | - // Load BOINC account and pre-authenticate with BOINC code |
|
| 764 | - require_boinc(array('util', 'cert')); |
|
| 765 | - $boincuser = BoincUser::lookup_id($drupuser->boincuser_id); |
|
| 766 | - //global $g_logged_in_user; |
|
| 767 | - //$g_logged_in_user = $boincuser; |
|
| 768 | - //print_r($boincuser); exit; |
|
| 769 | - switch ($type) { |
|
| 770 | - case 'all': |
|
| 761 | + global $user; |
|
| 762 | + $drupuser = user_load($user->uid); |
|
| 763 | + // Load BOINC account and pre-authenticate with BOINC code |
|
| 764 | + require_boinc(array('util', 'cert')); |
|
| 765 | + $boincuser = BoincUser::lookup_id($drupuser->boincuser_id); |
|
| 766 | + //global $g_logged_in_user; |
|
| 767 | + //$g_logged_in_user = $boincuser; |
|
| 768 | + //print_r($boincuser); exit; |
|
| 769 | + switch ($type) { |
|
| 770 | + case 'all': |
|
| 771 | 771 | //include_boinc('user/cert_all.php'); |
| 772 | 772 | require_boinc(array('util','cert','user')); |
| 773 | 773 | |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | "; |
| 838 | 838 | break; |
| 839 | 839 | |
| 840 | - case 'account': |
|
| 840 | + case 'account': |
|
| 841 | 841 | default: |
| 842 | 842 | //include_boinc('user/cert1.php'); |
| 843 | 843 | require_boinc(array('util','cert')); |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | echo " |
| 914 | 914 | </td><tr></table> |
| 915 | 915 | "; |
| 916 | - } |
|
| 916 | + } |
|
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | /** |
@@ -921,42 +921,42 @@ discard block |
||
| 921 | 921 | * Called when user selects to delete a host |
| 922 | 922 | */ |
| 923 | 923 | function boincwork_host_delete($host_id) { |
| 924 | - // Verify that host has no tasks |
|
| 925 | - if (boincwork_host_user_is_owner($host_id)) { |
|
| 924 | + // Verify that host has no tasks |
|
| 925 | + if (boincwork_host_user_is_owner($host_id)) { |
|
| 926 | 926 | if (!boincwork_host_get_task_count($host_id)) { |
| 927 | - // Delete the host record |
|
| 928 | - db_set_active('boinc_rw'); |
|
| 929 | - $host_deleted = db_query( |
|
| 927 | + // Delete the host record |
|
| 928 | + db_set_active('boinc_rw'); |
|
| 929 | + $host_deleted = db_query( |
|
| 930 | 930 | "DELETE FROM {host} WHERE id = '%d'", |
| 931 | 931 | $host_id |
| 932 | - ); |
|
| 933 | - db_set_active('default'); |
|
| 934 | - if ($host_deleted) { |
|
| 932 | + ); |
|
| 933 | + db_set_active('default'); |
|
| 934 | + if ($host_deleted) { |
|
| 935 | 935 | drupal_set_message(t('Host @id has been removed from your account.', |
| 936 | - array('@id' => $host_id))); |
|
| 936 | + array('@id' => $host_id))); |
|
| 937 | 937 | drupal_goto('account/computers'); |
| 938 | - } |
|
| 939 | - else { |
|
| 938 | + } |
|
| 939 | + else { |
|
| 940 | 940 | drupal_set_message(t('Host @id could not be deleted. Not sure why...', |
| 941 | - array('@id' => $host_id)), 'error' |
|
| 941 | + array('@id' => $host_id)), 'error' |
|
| 942 | 942 | ); |
| 943 | - } |
|
| 943 | + } |
|
| 944 | 944 | } |
| 945 | 945 | else { |
| 946 | - drupal_set_message(t('Host @id cannot be deleted because it still has |
|
| 946 | + drupal_set_message(t('Host @id cannot be deleted because it still has |
|
| 947 | 947 | tasks associated with it. These tasks should be processed within the |
| 948 | 948 | next few days, after which the host can be deleted.', |
| 949 | 949 | array('@id' => $host_id)), 'warning' |
| 950 | - ); |
|
| 950 | + ); |
|
| 951 | + } |
|
| 951 | 952 | } |
| 952 | - } |
|
| 953 | - else { |
|
| 953 | + else { |
|
| 954 | 954 | drupal_set_message(t('You are not the owner of host @id, so you cannot |
| 955 | 955 | delete it.', |
| 956 | - array('@id' => $host_id)), 'error' |
|
| 956 | + array('@id' => $host_id)), 'error' |
|
| 957 | 957 | ); |
| 958 | - } |
|
| 959 | - drupal_goto("host/{$host_id}"); |
|
| 958 | + } |
|
| 959 | + drupal_goto("host/{$host_id}"); |
|
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | /** |
@@ -964,55 +964,55 @@ discard block |
||
| 964 | 964 | * Called when user accesses the log for a host |
| 965 | 965 | */ |
| 966 | 966 | function boincwork_host_log($host_id = null) { |
| 967 | - $root_log_dir = variable_get('boinc_host_sched_logs_dir', ''); |
|
| 968 | - $log = ''; |
|
| 969 | - if ($root_log_dir AND $host_id) { |
|
| 967 | + $root_log_dir = variable_get('boinc_host_sched_logs_dir', ''); |
|
| 968 | + $log = ''; |
|
| 969 | + if ($root_log_dir AND $host_id) { |
|
| 970 | 970 | $subdir = substr($host_id, 0, -3) OR $subdir = 0; |
| 971 | 971 | $log = implode('/', array($root_log_dir, $subdir, $host_id)); |
| 972 | - } |
|
| 973 | - if ($log AND file_exists($log)) { |
|
| 972 | + } |
|
| 973 | + if ($log AND file_exists($log)) { |
|
| 974 | 974 | header('Content-type: text/plain'); |
| 975 | 975 | include($log); |
| 976 | - } |
|
| 976 | + } |
|
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | function boincwork_host_set_venue($host_id = NULL, $venue = NULL) { |
| 980 | - global $user; |
|
| 981 | - $account = user_load($user->uid); |
|
| 982 | - db_set_active('boinc_ro'); |
|
| 983 | - // Verify that this is my host |
|
| 984 | - $host_owner = db_result(db_query( |
|
| 980 | + global $user; |
|
| 981 | + $account = user_load($user->uid); |
|
| 982 | + db_set_active('boinc_ro'); |
|
| 983 | + // Verify that this is my host |
|
| 984 | + $host_owner = db_result(db_query( |
|
| 985 | 985 | "SELECT userid FROM {host} WHERE id = '%d'", |
| 986 | 986 | $host_id |
| 987 | - )); |
|
| 988 | - db_set_active('default'); |
|
| 989 | - if ($host_owner AND $host_owner == $account->boincuser_id) { |
|
| 987 | + )); |
|
| 988 | + db_set_active('default'); |
|
| 989 | + if ($host_owner AND $host_owner == $account->boincuser_id) { |
|
| 990 | 990 | db_set_active('boinc_rw'); |
| 991 | 991 | $updated = db_query( |
| 992 | - "UPDATE {host} SET venue = '%s' WHERE id = '%d'", |
|
| 993 | - $venue, $host_id |
|
| 992 | + "UPDATE {host} SET venue = '%s' WHERE id = '%d'", |
|
| 993 | + $venue, $host_id |
|
| 994 | 994 | ); |
| 995 | 995 | db_set_active('default'); |
| 996 | 996 | if ($updated) { |
| 997 | - drupal_set_message( |
|
| 997 | + drupal_set_message( |
|
| 998 | 998 | bts('The location for this host has been updated.', array(), NULL, 'boinc:account-host-details') |
| 999 | 999 | . bts('This will take effect next time the host contacts the project.', array(), NULL, 'boinc:account-host-details') |
| 1000 | - ); |
|
| 1000 | + ); |
|
| 1001 | 1001 | } |
| 1002 | 1002 | else { |
| 1003 | - drupal_set_message( |
|
| 1003 | + drupal_set_message( |
|
| 1004 | 1004 | bts('Unable to save changes to this host for some reason!', array(), NULL, 'boinc:account-host-details'), |
| 1005 | 1005 | 'error' |
| 1006 | - ); |
|
| 1006 | + ); |
|
| 1007 | 1007 | } |
| 1008 | - } |
|
| 1009 | - else { |
|
| 1008 | + } |
|
| 1009 | + else { |
|
| 1010 | 1010 | drupal_set_message( |
| 1011 | - bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
|
| 1012 | - 'warning' |
|
| 1011 | + bts('You are not allowed to make changes to this host.', array(), NULL, 'boinc:account-host-details'), |
|
| 1012 | + 'warning' |
|
| 1013 | 1013 | ); |
| 1014 | - } |
|
| 1015 | - drupal_goto("host/{$host_id}"); |
|
| 1014 | + } |
|
| 1015 | + drupal_goto("host/{$host_id}"); |
|
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | /** |
@@ -1020,8 +1020,8 @@ discard block |
||
| 1020 | 1020 | * Called when user accesses cell phone stats |
| 1021 | 1021 | */ |
| 1022 | 1022 | function boincwork_mobile_stats($userid = null) { |
| 1023 | - $_GET['id'] = $userid; |
|
| 1024 | - include_boinc('user/userw.php'); |
|
| 1023 | + $_GET['id'] = $userid; |
|
| 1024 | + include_boinc('user/userw.php'); |
|
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | 1027 | /** |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | * Called to build the server status page |
| 1030 | 1030 | */ |
| 1031 | 1031 | function boincwork_server_status() { |
| 1032 | - include_boinc('user/server_status.php'); |
|
| 1032 | + include_boinc('user/server_status.php'); |
|
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | /** |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | * RPC for managing job input files |
| 1038 | 1038 | */ |
| 1039 | 1039 | function boincwork_job_file() { |
| 1040 | - include_boinc('user/job_file.php'); |
|
| 1040 | + include_boinc('user/job_file.php'); |
|
| 1041 | 1041 | } |
| 1042 | 1042 | |
| 1043 | 1043 | /** |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | * Get output file from remote job submission |
| 1046 | 1046 | */ |
| 1047 | 1047 | function boincwork_get_output() { |
| 1048 | - include_boinc('user/get_output.php'); |
|
| 1048 | + include_boinc('user/get_output.php'); |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | /** |
@@ -1053,28 +1053,28 @@ discard block |
||
| 1053 | 1053 | * Get the project configuration XML; used by client software |
| 1054 | 1054 | */ |
| 1055 | 1055 | function boincwork_get_project_config() { |
| 1056 | - ob_start(); |
|
| 1057 | - include_boinc('user/get_project_config.php'); |
|
| 1058 | - $xml = ob_get_clean(); |
|
| 1059 | - $xml = load_configuration($xml); |
|
| 1060 | - |
|
| 1061 | - // obtain Drupal variables |
|
| 1062 | - $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
| 1063 | - $overrideboinctou = variable_get('boinc_weboptions_overrideboinctou', FALSE); |
|
| 1064 | - |
|
| 1065 | - // If terms of use string exists and override is true, set terms-of-use |
|
| 1066 | - // to Drupal varaible. |
|
| 1067 | - if ( (!empty($termsofuse) && ($overrideboinctou)) ) { |
|
| 1056 | + ob_start(); |
|
| 1057 | + include_boinc('user/get_project_config.php'); |
|
| 1058 | + $xml = ob_get_clean(); |
|
| 1059 | + $xml = load_configuration($xml); |
|
| 1060 | + |
|
| 1061 | + // obtain Drupal variables |
|
| 1062 | + $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
|
| 1063 | + $overrideboinctou = variable_get('boinc_weboptions_overrideboinctou', FALSE); |
|
| 1064 | + |
|
| 1065 | + // If terms of use string exists and override is true, set terms-of-use |
|
| 1066 | + // to Drupal varaible. |
|
| 1067 | + if ( (!empty($termsofuse) && ($overrideboinctou)) ) { |
|
| 1068 | 1068 | if (!empty($xml['project_config']['terms_of_use'])) { |
| 1069 | - // Remove any existing terms of use |
|
| 1070 | - unset($xml['project_config']['terms_of_use']); |
|
| 1069 | + // Remove any existing terms of use |
|
| 1070 | + unset($xml['project_config']['terms_of_use']); |
|
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | // Add terms of use from Drupal |
| 1074 | 1074 | $xml['project_config']['terms_of_use']['@value'] = $termsofuse; |
| 1075 | - } |
|
| 1075 | + } |
|
| 1076 | 1076 | |
| 1077 | - print save_configuration($xml); |
|
| 1077 | + print save_configuration($xml); |
|
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | 1080 | |
@@ -1082,16 +1082,16 @@ discard block |
||
| 1082 | 1082 | * Page callback for the remote job submission RPC (submit_rpc_handler.php). |
| 1083 | 1083 | */ |
| 1084 | 1084 | function boincwork_submit_rpc_handler() { |
| 1085 | - include_boinc('user/submit_rpc_handler.php'); |
|
| 1085 | + include_boinc('user/submit_rpc_handler.php'); |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | /** |
| 1089 | 1089 | * Page callback for user WAP (userw.php). |
| 1090 | 1090 | */ |
| 1091 | 1091 | function boincwork_user_wap() { |
| 1092 | - // Remove q from the GET request or BOINC will panic |
|
| 1093 | - unset($_GET['q']); |
|
| 1094 | - include_boinc('user/userw.php'); |
|
| 1092 | + // Remove q from the GET request or BOINC will panic |
|
| 1093 | + unset($_GET['q']); |
|
| 1094 | + include_boinc('user/userw.php'); |
|
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | 1097 | |
@@ -1099,44 +1099,44 @@ discard block |
||
| 1099 | 1099 | * Page callback for user account task table |
| 1100 | 1100 | */ |
| 1101 | 1101 | function boincwork_account_task_table($tselect = NULL, $app_id = NULL) { |
| 1102 | - $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table'); |
|
| 1103 | - drupal_set_title($title); |
|
| 1102 | + $title = bts('Tasks for your account', array(), NULL, 'boinc:account-task-table'); |
|
| 1103 | + drupal_set_title($title); |
|
| 1104 | 1104 | |
| 1105 | - global $user; |
|
| 1106 | - $account = user_load($user->uid); |
|
| 1107 | - return boincwork_tasktable(0, $account->boincuser_id, $tselect, $app_id); |
|
| 1105 | + global $user; |
|
| 1106 | + $account = user_load($user->uid); |
|
| 1107 | + return boincwork_tasktable(0, $account->boincuser_id, $tselect, $app_id); |
|
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 | /** |
| 1111 | 1111 | * Page callback for host task table |
| 1112 | 1112 | */ |
| 1113 | 1113 | function boincwork_host_task_table($host_id = NULL, $tselect = NULL, $app_id = NULL) { |
| 1114 | - require_boinc( array('util', 'result') ); |
|
| 1114 | + require_boinc( array('util', 'result') ); |
|
| 1115 | 1115 | |
| 1116 | - $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table'); |
|
| 1117 | - drupal_set_title($title); |
|
| 1116 | + $title = bts('Tasks for computer @host_id', array('@host_id' => $host_id), NULL, 'boinc:host-task-table'); |
|
| 1117 | + drupal_set_title($title); |
|
| 1118 | 1118 | |
| 1119 | - if (is_null($host_id)) { |
|
| 1119 | + if (is_null($host_id)) { |
|
| 1120 | 1120 | drupal_set_message(bts('ERROR: Invalid host ID', array(), NULL, 'boinc:host-task-table'), 'error'); |
| 1121 | 1121 | return ''; |
| 1122 | - } |
|
| 1122 | + } |
|
| 1123 | 1123 | |
| 1124 | - return boincwork_tasktable(2, $host_id, $tselect, $app_id); |
|
| 1124 | + return boincwork_tasktable(2, $host_id, $tselect, $app_id); |
|
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | 1127 | /** |
| 1128 | 1128 | * Page callback for workunit task table |
| 1129 | 1129 | */ |
| 1130 | 1130 | function boincwork_workunit_task_table($workunit_id = NULL, $tselect = NULL, $app_id = NULL) { |
| 1131 | - $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table'); |
|
| 1132 | - drupal_set_title($title); |
|
| 1131 | + $title = bts('Tasks for workunit @workunit_id', array('@workunit_id' => $workunit_id), NULL, 'boinc:workunit-task-table'); |
|
| 1132 | + drupal_set_title($title); |
|
| 1133 | 1133 | |
| 1134 | - if (is_null($workunit_id)) { |
|
| 1134 | + if (is_null($workunit_id)) { |
|
| 1135 | 1135 | drupal_set_message(bts('ERROR: Invalid workunit ID', array(), NULL, 'boinc:workunit-task-table'), 'error'); |
| 1136 | 1136 | return ''; |
| 1137 | - } |
|
| 1137 | + } |
|
| 1138 | 1138 | |
| 1139 | - return boincwork_tasktable(1, $workunit_id, $tselect, $app_id); |
|
| 1139 | + return boincwork_tasktable(1, $workunit_id, $tselect, $app_id); |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | /** |
@@ -1144,8 +1144,8 @@ discard block |
||
| 1144 | 1144 | * Take a node ID and render that node as a page |
| 1145 | 1145 | */ |
| 1146 | 1146 | function boincwork_view_page($nid) { |
| 1147 | - $node = node_load($nid); |
|
| 1148 | - return node_page_view($node); |
|
| 1147 | + $node = node_load($nid); |
|
| 1148 | + return node_page_view($node); |
|
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | |
@@ -1157,16 +1157,16 @@ discard block |
||
| 1157 | 1157 | * Determine which venue should be selected |
| 1158 | 1158 | */ |
| 1159 | 1159 | function boincwork_select_venue(&$venue) { |
| 1160 | - if (!$venue) { |
|
| 1160 | + if (!$venue) { |
|
| 1161 | 1161 | $active_venue = isset($_SESSION['prefs venue']) ? $_SESSION['prefs venue'] : NULL; |
| 1162 | 1162 | if ($active_venue) { |
| 1163 | - $venue = $active_venue; |
|
| 1164 | - //unset($_SESSION['prefs venue']); |
|
| 1163 | + $venue = $active_venue; |
|
| 1164 | + //unset($_SESSION['prefs venue']); |
|
| 1165 | + } |
|
| 1165 | 1166 | } |
| 1166 | - } |
|
| 1167 | - else { |
|
| 1167 | + else { |
|
| 1168 | 1168 | // Set the active venue to keep it selected between computing and project |
| 1169 | 1169 | // preference pages |
| 1170 | 1170 | $_SESSION['prefs venue'] = $venue; |
| 1171 | - } |
|
| 1171 | + } |
|
| 1172 | 1172 | } |
@@ -26,82 +26,82 @@ discard block |
||
| 26 | 26 | * Implementation of hook_menu() |
| 27 | 27 | */ |
| 28 | 28 | function boincteam_menu() { |
| 29 | - $items = array(); |
|
| 30 | - $items['community/teams/%/assume-foundership'] = array( |
|
| 29 | + $items = array(); |
|
| 30 | + $items['community/teams/%/assume-foundership'] = array( |
|
| 31 | 31 | 'page callback' => 'boincteam_assume_foundership', |
| 32 | 32 | 'page arguments' => array(2), |
| 33 | 33 | 'access callback' => 'boincteam_is_member', |
| 34 | 34 | 'access arguments' => array(2), |
| 35 | 35 | 'type' => MENU_CALLBACK |
| 36 | - ); |
|
| 37 | - $items['community/teams/%/join'] = array( |
|
| 36 | + ); |
|
| 37 | + $items['community/teams/%/join'] = array( |
|
| 38 | 38 | 'page callback' => 'boincteam_join', |
| 39 | 39 | 'page arguments' => array(2), |
| 40 | 40 | 'access arguments' => array('join boincteam'), |
| 41 | 41 | 'type' => MENU_CALLBACK |
| 42 | - ); |
|
| 43 | - $items['community/teams/%/leave'] = array( |
|
| 42 | + ); |
|
| 43 | + $items['community/teams/%/leave'] = array( |
|
| 44 | 44 | 'page callback' => 'boincteam_leave', |
| 45 | 45 | 'page arguments' => array(2), |
| 46 | 46 | 'access arguments' => array('join boincteam'), |
| 47 | 47 | 'type' => MENU_CALLBACK |
| 48 | - ); |
|
| 49 | - $items['community/teams/%/delete'] = array( |
|
| 48 | + ); |
|
| 49 | + $items['community/teams/%/delete'] = array( |
|
| 50 | 50 | 'page callback' => 'boincteam_delete', |
| 51 | 51 | 'page arguments' => array(2), |
| 52 | 52 | 'access callback' => 'boincteam_is_founder', |
| 53 | 53 | 'access arguments' => array(2), |
| 54 | 54 | 'type' => MENU_CALLBACK |
| 55 | - ); |
|
| 56 | - $items['community/teams/%/deny-foundership-request'] = array( |
|
| 55 | + ); |
|
| 56 | + $items['community/teams/%/deny-foundership-request'] = array( |
|
| 57 | 57 | 'page callback' => 'boincteam_deny_foundership_request', |
| 58 | 58 | 'page arguments' => array(2), |
| 59 | 59 | 'access callback' => 'boincteam_is_founder', |
| 60 | 60 | 'access arguments' => array(2), |
| 61 | 61 | 'type' => MENU_CALLBACK |
| 62 | - ); |
|
| 63 | - $items['community/teams/%/edit/admins/remove/%'] = array( |
|
| 62 | + ); |
|
| 63 | + $items['community/teams/%/edit/admins/remove/%'] = array( |
|
| 64 | 64 | 'page callback' => 'boincteam_remove_admin', |
| 65 | 65 | 'page arguments' => array(2,6), |
| 66 | 66 | 'access callback' => 'boincteam_is_founder', |
| 67 | 67 | 'access arguments' => array(2), |
| 68 | 68 | 'type' => MENU_CALLBACK |
| 69 | - ); |
|
| 70 | - $items['community/teams/%/edit/founder/set/%'] = array( |
|
| 69 | + ); |
|
| 70 | + $items['community/teams/%/edit/founder/set/%'] = array( |
|
| 71 | 71 | 'page callback' => 'boincteam_set_founder', |
| 72 | 72 | 'page arguments' => array(2,6), |
| 73 | 73 | 'access callback' => 'boincteam_is_founder', |
| 74 | 74 | 'access arguments' => array(2), |
| 75 | 75 | 'type' => MENU_CALLBACK |
| 76 | - ); |
|
| 77 | - $items['community/teams/%/edit/members/remove/%'] = array( |
|
| 76 | + ); |
|
| 77 | + $items['community/teams/%/edit/members/remove/%'] = array( |
|
| 78 | 78 | 'page callback' => 'boincteam_remove_member', |
| 79 | 79 | 'page arguments' => array(2,6), |
| 80 | 80 | 'access callback' => 'boincteam_is_founder', |
| 81 | 81 | 'access arguments' => array(2), |
| 82 | 82 | 'type' => MENU_CALLBACK |
| 83 | - ); |
|
| 84 | - $items['community/teams/%/history/xml'] = array( |
|
| 83 | + ); |
|
| 84 | + $items['community/teams/%/history/xml'] = array( |
|
| 85 | 85 | 'page callback' => 'boincteam_history_xml', |
| 86 | 86 | 'page arguments' => array(2), |
| 87 | 87 | 'access callback' => 'boincteam_is_admin', |
| 88 | 88 | 'access arguments' => array(2), |
| 89 | 89 | 'type' => MENU_CALLBACK |
| 90 | - ); |
|
| 91 | - $items['community/teams/%/request-foundership'] = array( |
|
| 90 | + ); |
|
| 91 | + $items['community/teams/%/request-foundership'] = array( |
|
| 92 | 92 | 'page callback' => 'boincteam_request_foundership', |
| 93 | 93 | 'page arguments' => array(2), |
| 94 | 94 | 'access callback' => 'boincteam_is_member', |
| 95 | 95 | 'access arguments' => array(2), |
| 96 | 96 | 'type' => MENU_CALLBACK |
| 97 | - ); |
|
| 98 | - $items['community/teams/%/user-name-autocomplete'] = array( |
|
| 97 | + ); |
|
| 98 | + $items['community/teams/%/user-name-autocomplete'] = array( |
|
| 99 | 99 | 'page callback' => '_boincuser_user_name_autocomplete', |
| 100 | 100 | 'access callback' => 'boincteam_is_founder', |
| 101 | 101 | 'access arguments' => array(2), |
| 102 | 102 | 'type' => MENU_CALLBACK, |
| 103 | - ); |
|
| 104 | - $items['admin/boinc/utility-team-delete'] = array( |
|
| 103 | + ); |
|
| 104 | + $items['admin/boinc/utility-team-delete'] = array( |
|
| 105 | 105 | 'title' => 'Utility: Delete SPAM Teams', |
| 106 | 106 | 'description' => 'Utililities to help delete BOINC teams created by SPAMMERs.', |
| 107 | 107 | 'page callback' => 'drupal_get_form', |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | 'access arguments' => array('administer site configuration'), |
| 110 | 110 | 'type' => MENU_NORMAL_ITEM, |
| 111 | 111 | 'file' => 'boincteam.admin.inc', |
| 112 | - ); |
|
| 112 | + ); |
|
| 113 | 113 | |
| 114 | - return $items; |
|
| 114 | + return $items; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -128,41 +128,41 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | See https://www.drupal.org/node/945102 |
| 130 | 130 | */ |
| 131 | - return array( |
|
| 131 | + return array( |
|
| 132 | 132 | 'boincteam_utility_team_table' => array( |
| 133 | - 'arguments' => array('form' => NULL), |
|
| 134 | - 'file' => 'boincteam.admin.inc', |
|
| 133 | + 'arguments' => array('form' => NULL), |
|
| 134 | + 'file' => 'boincteam.admin.inc', |
|
| 135 | 135 | ), |
| 136 | - ); |
|
| 136 | + ); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * Implementation of hook_views_api(). |
| 141 | 141 | */ |
| 142 | 142 | function boincteam_views_api() { |
| 143 | - return array( |
|
| 143 | + return array( |
|
| 144 | 144 | 'api' => 2.0, |
| 145 | 145 | 'path' => drupal_get_path('module', 'boincteam') |
| 146 | - ); |
|
| 146 | + ); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * Implementation of hook_perm() |
| 151 | 151 | */ |
| 152 | 152 | function boincteam_perm() { |
| 153 | - return array('join boincteam', 'create boincteam', 'manage boincteam'); |
|
| 153 | + return array('join boincteam', 'create boincteam', 'manage boincteam'); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | 157 | * Implementation of hook_cron() |
| 158 | 158 | */ |
| 159 | 159 | function boincteam_cron() { |
| 160 | - // Sync teams from BOINC DB every day to catch BOINC-wide team updates |
|
| 161 | - $last_sync = variable_get('boincteam_last_sync', 0); |
|
| 162 | - if ($last_sync < time() - 24*60*60) { |
|
| 160 | + // Sync teams from BOINC DB every day to catch BOINC-wide team updates |
|
| 161 | + $last_sync = variable_get('boincteam_last_sync', 0); |
|
| 162 | + if ($last_sync < time() - 24*60*60) { |
|
| 163 | 163 | boincteam_sync(); |
| 164 | 164 | variable_set('boincteam_last_sync', time()); |
| 165 | - } |
|
| 165 | + } |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -176,31 +176,31 @@ discard block |
||
| 176 | 176 | * Implementation of hook_views_pre_execute(). |
| 177 | 177 | */ |
| 178 | 178 | function boincteam_views_pre_execute(&$view) { |
| 179 | - /* Specific boinc_teams sub-views use the boinc readonly replica |
|
| 179 | + /* Specific boinc_teams sub-views use the boinc readonly replica |
|
| 180 | 180 | * DB. These sub-views defined below by their title. If additional |
| 181 | 181 | * sub-views need to be added, add their title to the list of cases |
| 182 | 182 | * below. If a sub-view needs to be reverted to use the master DB, |
| 183 | 183 | * then remove it from the list of cases. |
| 184 | 184 | */ |
| 185 | - if ($view->name == 'boinc_teams') { |
|
| 185 | + if ($view->name == 'boinc_teams') { |
|
| 186 | 186 | switch ($view->display[$view->current_display]->display_title) { |
| 187 | 187 | case 'Top teams overview pane': |
| 188 | 188 | case 'Top teams pane': |
| 189 | 189 | case 'Page': |
| 190 | 190 | $view->base_database = 'boinc_ro'; |
| 191 | 191 | } |
| 192 | - } |
|
| 192 | + } |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | 196 | * Implementation of hook_cron_queue_info() |
| 197 | 197 | */ |
| 198 | 198 | function boincteam_cron_queue_info() { |
| 199 | - $queues = array(); |
|
| 200 | - $queues['queue_teamdelete'] = array( |
|
| 199 | + $queues = array(); |
|
| 200 | + $queues['queue_teamdelete'] = array( |
|
| 201 | 201 | 'worker callback' => 'boincteam_delete', |
| 202 | 202 | 'time' => 60, |
| 203 | - ); |
|
| 203 | + ); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * |
@@ -212,49 +212,49 @@ discard block |
||
| 212 | 212 | * assume the role of founder |
| 213 | 213 | */ |
| 214 | 214 | function boincteam_assume_foundership($team_id) { |
| 215 | - global $user; |
|
| 216 | - $account = user_load($user->uid); |
|
| 217 | - $team = node_load($team_id); |
|
| 218 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 219 | - $boincteam = boincteam_load($boincteam_id); |
|
| 220 | - $boincuser_id = $account->boincuser_id; |
|
| 215 | + global $user; |
|
| 216 | + $account = user_load($user->uid); |
|
| 217 | + $team = node_load($team_id); |
|
| 218 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 219 | + $boincteam = boincteam_load($boincteam_id); |
|
| 220 | + $boincuser_id = $account->boincuser_id; |
|
| 221 | 221 | |
| 222 | - if (boincteam_foundership_transfer_ok($boincteam)) { |
|
| 222 | + if (boincteam_foundership_transfer_ok($boincteam)) { |
|
| 223 | 223 | if ($boincuser_id == $boincteam->ping_user) { |
| 224 | - db_set_active('boinc_rw'); |
|
| 225 | - db_query(" |
|
| 224 | + db_set_active('boinc_rw'); |
|
| 225 | + db_query(" |
|
| 226 | 226 | UPDATE {team} |
| 227 | 227 | SET userid = '%d', ping_user = '0', ping_time = '0' |
| 228 | 228 | WHERE id = '%d'", |
| 229 | 229 | $boincuser_id, $boincteam_id |
| 230 | - ); |
|
| 231 | - db_set_active('default'); |
|
| 232 | - drupal_set_message(t('You are now the founder of @team', array( |
|
| 230 | + ); |
|
| 231 | + db_set_active('default'); |
|
| 232 | + drupal_set_message(t('You are now the founder of @team', array( |
|
| 233 | 233 | '@team' => $team->title |
| 234 | - ))); |
|
| 235 | - watchdog('boincteam', 'User @user assumed foundership of team @nid', |
|
| 234 | + ))); |
|
| 235 | + watchdog('boincteam', 'User @user assumed foundership of team @nid', |
|
| 236 | 236 | array( |
| 237 | - '@current_user' => $account->uid, |
|
| 238 | - '@nid' => $team_id |
|
| 237 | + '@current_user' => $account->uid, |
|
| 238 | + '@nid' => $team_id |
|
| 239 | 239 | ), WATCHDOG_NOTICE |
| 240 | - ); |
|
| 240 | + ); |
|
| 241 | 241 | } |
| 242 | - } |
|
| 243 | - else { |
|
| 242 | + } |
|
| 243 | + else { |
|
| 244 | 244 | drupal_set_message(t('You are not allowed to assume foundership of this |
| 245 | 245 | team.' |
| 246 | 246 | )); |
| 247 | - } |
|
| 248 | - drupal_goto("community/teams/{$team_id}"); |
|
| 247 | + } |
|
| 248 | + drupal_goto("community/teams/{$team_id}"); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Delete the team, if empty |
| 253 | 253 | */ |
| 254 | 254 | function boincteam_delete($team_id) { |
| 255 | - $team = node_load($team_id); |
|
| 256 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
| 257 | - if ($boincteam->nusers == 1) { |
|
| 255 | + $team = node_load($team_id); |
|
| 256 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
| 257 | + if ($boincteam->nusers == 1) { |
|
| 258 | 258 | require_boinc('team'); |
| 259 | 259 | $boincuser = boincuser_load(); |
| 260 | 260 | user_quit_team($boincuser); |
@@ -263,35 +263,35 @@ discard block |
||
| 263 | 263 | $team->uid = 0; |
| 264 | 264 | node_save($team); |
| 265 | 265 | drupal_set_message(t('@team has been removed.', |
| 266 | - array('@team' => $boincteam->name))); |
|
| 266 | + array('@team' => $boincteam->name))); |
|
| 267 | 267 | drupal_goto('community/teams'); |
| 268 | - } |
|
| 269 | - else { |
|
| 268 | + } |
|
| 269 | + else { |
|
| 270 | 270 | drupal_set_message(t('All members must be removed from @team before the |
| 271 | 271 | team can be deleted.', array('@team' => $boincteam->name)), 'error'); |
| 272 | 272 | drupal_goto(strstr($_GET['q'], '/delete', TRUE)); |
| 273 | - } |
|
| 273 | + } |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | /** |
| 277 | 277 | * Deny a foundership transfer request |
| 278 | 278 | */ |
| 279 | 279 | function boincteam_deny_foundership_request($team_id) { |
| 280 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 281 | - // Remove the request from the BOINC database |
|
| 282 | - db_set_active('boinc_rw'); |
|
| 283 | - db_query(" |
|
| 280 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 281 | + // Remove the request from the BOINC database |
|
| 282 | + db_set_active('boinc_rw'); |
|
| 283 | + db_query(" |
|
| 284 | 284 | UPDATE {team} |
| 285 | 285 | SET ping_user=0 |
| 286 | 286 | WHERE id = '%d'", |
| 287 | 287 | $boincteam_id |
| 288 | - ); |
|
| 289 | - db_set_active('default'); |
|
| 288 | + ); |
|
| 289 | + db_set_active('default'); |
|
| 290 | 290 | |
| 291 | - drupal_set_message(t('The transfer request has been denied. No additional |
|
| 291 | + drupal_set_message(t('The transfer request has been denied. No additional |
|
| 292 | 292 | requests will be allowed until 90 days have passed since this request was |
| 293 | 293 | made.')); |
| 294 | - drupal_goto("community/teams/{$team_id}/edit/founder"); |
|
| 294 | + drupal_goto("community/teams/{$team_id}/edit/founder"); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
@@ -299,62 +299,62 @@ discard block |
||
| 299 | 299 | * Get the join date of a user |
| 300 | 300 | */ |
| 301 | 301 | function boincteam_get_member_join_date($boincteam_id, $boincuser_id = NULL) { |
| 302 | - if (!$boincuser_id) { |
|
| 302 | + if (!$boincuser_id) { |
|
| 303 | 303 | global $user; |
| 304 | 304 | $account = user_load($user->uid); |
| 305 | 305 | $boincuser_id = $account->boincuser_id; |
| 306 | - } |
|
| 307 | - db_set_active('boinc_rw'); |
|
| 308 | - $timestamp = db_result(db_query(" |
|
| 306 | + } |
|
| 307 | + db_set_active('boinc_rw'); |
|
| 308 | + $timestamp = db_result(db_query(" |
|
| 309 | 309 | SELECT timestamp FROM {team_delta} WHERE |
| 310 | 310 | userid = %d AND teamid = %d AND joining = 1 |
| 311 | 311 | ORDER BY timestamp DESC LIMIT 1", |
| 312 | 312 | $boincuser_id, $boincteam_id |
| 313 | - )); |
|
| 314 | - db_set_active('default'); |
|
| 315 | - return $timestamp; |
|
| 313 | + )); |
|
| 314 | + db_set_active('default'); |
|
| 315 | + return $timestamp; |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
| 319 | 319 | * Get the team type for display |
| 320 | 320 | */ |
| 321 | 321 | function boincteam_get_type($team_id) { |
| 322 | - //$vid = boincteam_get_vocabulary_by_name('Teams'); $team->vid = $vid; |
|
| 323 | - $team = node_load($team_id); |
|
| 324 | - $terms = taxonomy_node_get_terms($team); |
|
| 325 | - if ($terms) { |
|
| 322 | + //$vid = boincteam_get_vocabulary_by_name('Teams'); $team->vid = $vid; |
|
| 323 | + $team = node_load($team_id); |
|
| 324 | + $terms = taxonomy_node_get_terms($team); |
|
| 325 | + if ($terms) { |
|
| 326 | 326 | $term = reset($terms); |
| 327 | 327 | return $term->name; |
| 328 | - } else { |
|
| 328 | + } else { |
|
| 329 | 329 | return null; |
| 330 | - } |
|
| 330 | + } |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
| 334 | 334 | * Access a vocabulary of terms by name |
| 335 | 335 | */ |
| 336 | 336 | function boincteam_get_vocabulary_by_name($name) { |
| 337 | - $vocabs = taxonomy_get_vocabularies('team'); |
|
| 338 | - foreach ($vocabs as $vocab) { |
|
| 337 | + $vocabs = taxonomy_get_vocabularies('team'); |
|
| 338 | + foreach ($vocabs as $vocab) { |
|
| 339 | 339 | if ($vocab->name == $name) return $vocab->vid; |
| 340 | - } |
|
| 341 | - return null; |
|
| 340 | + } |
|
| 341 | + return null; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
| 345 | 345 | * Output the XML of the team history |
| 346 | 346 | */ |
| 347 | 347 | function boincteam_history_xml($team_id) { |
| 348 | - $team = node_load($team_id); |
|
| 349 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 350 | - $team_history = array( |
|
| 348 | + $team = node_load($team_id); |
|
| 349 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 350 | + $team_history = array( |
|
| 351 | 351 | 'actions' => array( |
| 352 | - 'action' => array(), |
|
| 352 | + 'action' => array(), |
|
| 353 | 353 | ), |
| 354 | - ); |
|
| 354 | + ); |
|
| 355 | 355 | |
| 356 | - db_set_active('boinc_rw'); |
|
| 357 | - $result = db_query(" |
|
| 356 | + db_set_active('boinc_rw'); |
|
| 357 | + $result = db_query(" |
|
| 358 | 358 | SELECT |
| 359 | 359 | td.userid AS id, |
| 360 | 360 | u.name, |
@@ -366,40 +366,40 @@ discard block |
||
| 366 | 366 | WHERE td.teamid = %d |
| 367 | 367 | ORDER BY timestamp ASC", |
| 368 | 368 | $boincteam_id |
| 369 | - ); |
|
| 370 | - db_set_active('default'); |
|
| 369 | + ); |
|
| 370 | + db_set_active('default'); |
|
| 371 | 371 | |
| 372 | - while ($record = db_fetch_array($result)) { |
|
| 372 | + while ($record = db_fetch_array($result)) { |
|
| 373 | 373 | $team_history['actions']['action'][] = $record; |
| 374 | - } |
|
| 374 | + } |
|
| 375 | 375 | |
| 376 | - header('Content-type: text/xml'); |
|
| 377 | - echo xml_to_text(array_to_xml($team_history)); |
|
| 376 | + header('Content-type: text/xml'); |
|
| 377 | + echo xml_to_text(array_to_xml($team_history)); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
| 381 | 381 | * Convert a BOINC team ID to a Drupal team ID |
| 382 | 382 | */ |
| 383 | 383 | function boincteam_lookup_nid($boinc_id) { |
| 384 | - $drupal_id = db_result(db_query("SELECT nid FROM {boincteam} WHERE team_id='%d'", $boinc_id)); |
|
| 385 | - return $drupal_id; |
|
| 384 | + $drupal_id = db_result(db_query("SELECT nid FROM {boincteam} WHERE team_id='%d'", $boinc_id)); |
|
| 385 | + return $drupal_id; |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
| 389 | 389 | * Convert a Drupal team ID to a BOINC team ID |
| 390 | 390 | */ |
| 391 | 391 | function boincteam_lookup_id($nid) { |
| 392 | - $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = '%d'", $nid)); |
|
| 393 | - return $boinc_id; |
|
| 392 | + $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = '%d'", $nid)); |
|
| 393 | + return $boinc_id; |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /** |
| 397 | 397 | * Get a BOINC team object |
| 398 | 398 | */ |
| 399 | 399 | function boincteam_load($boincteam_id, $full_object = FALSE) { |
| 400 | - require_boinc(array('team')); |
|
| 401 | - $team = BoincTeam::lookup_id($boincteam_id); |
|
| 402 | - if ($team AND $full_object) { |
|
| 400 | + require_boinc(array('team')); |
|
| 401 | + $team = BoincTeam::lookup_id($boincteam_id); |
|
| 402 | + if ($team AND $full_object) { |
|
| 403 | 403 | $team->nusers = BoincUser::count("teamid={$team->id}"); |
| 404 | 404 | $team->nusers_worked = BoincUser::count("teamid={$team->id} and total_credit>0"); |
| 405 | 405 | $team->nusers_active = BoincUser::count("teamid={$team->id} and expavg_credit>0.1"); |
@@ -407,313 +407,313 @@ discard block |
||
| 407 | 407 | $team->new_members = new_member_list($boincteam_id); |
| 408 | 408 | $team->admins = admin_list($boincteam_id); |
| 409 | 409 | $team->founder = BoincUser::lookup_id($team->userid); |
| 410 | - } |
|
| 411 | - return $team; |
|
| 410 | + } |
|
| 411 | + return $team; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
| 415 | 415 | * Check if a user is the team founder |
| 416 | 416 | */ |
| 417 | 417 | function boincteam_is_founder($nid, $uid = NULL) { |
| 418 | - if (!$uid) { |
|
| 418 | + if (!$uid) { |
|
| 419 | 419 | global $user; |
| 420 | 420 | $uid = $user->uid; |
| 421 | - } |
|
| 422 | - if (!boincteam_is_member($nid, $uid)) { |
|
| 421 | + } |
|
| 422 | + if (!boincteam_is_member($nid, $uid)) { |
|
| 423 | 423 | return FALSE; |
| 424 | - } |
|
| 425 | - $team_id = boincteam_lookup_id($nid); |
|
| 426 | - require_boinc('team'); |
|
| 427 | - return is_team_founder(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
| 424 | + } |
|
| 425 | + $team_id = boincteam_lookup_id($nid); |
|
| 426 | + require_boinc('team'); |
|
| 427 | + return is_team_founder(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /** |
| 431 | 431 | * Check if a user is a team admin |
| 432 | 432 | */ |
| 433 | 433 | function boincteam_is_admin($nid, $uid = NULL) { |
| 434 | - if (!$uid) { |
|
| 434 | + if (!$uid) { |
|
| 435 | 435 | global $user; |
| 436 | 436 | $uid = $user->uid; |
| 437 | - } |
|
| 438 | - if (!boincteam_is_member($nid, $uid)) { |
|
| 437 | + } |
|
| 438 | + if (!boincteam_is_member($nid, $uid)) { |
|
| 439 | 439 | return FALSE; |
| 440 | - } |
|
| 441 | - $team_id = boincteam_lookup_id($nid); |
|
| 442 | - require_boinc('team'); |
|
| 443 | - return is_team_admin(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
| 440 | + } |
|
| 441 | + $team_id = boincteam_lookup_id($nid); |
|
| 442 | + require_boinc('team'); |
|
| 443 | + return is_team_admin(boincuser_load($uid, TRUE), boincteam_load($team_id)); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | /** |
| 447 | 447 | * Check if a user is a team member |
| 448 | 448 | */ |
| 449 | 449 | function boincteam_is_member($nid, $uid = NULL) { |
| 450 | - if (!$uid) { |
|
| 450 | + if (!$uid) { |
|
| 451 | 451 | global $user; |
| 452 | 452 | $uid = $user->uid; |
| 453 | - } |
|
| 454 | - $account = user_load($uid); |
|
| 455 | - return ($account->team == $nid); |
|
| 453 | + } |
|
| 454 | + $account = user_load($uid); |
|
| 455 | + return ($account->team == $nid); |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | /** |
| 459 | 459 | * Display any persistent team messages |
| 460 | 460 | */ |
| 461 | 461 | function boincteam_show_messages() { |
| 462 | - global $user; |
|
| 463 | - $uid = $user->uid; |
|
| 464 | - $account = user_load($uid); |
|
| 465 | - if ($account->team) { |
|
| 462 | + global $user; |
|
| 463 | + $uid = $user->uid; |
|
| 464 | + $account = user_load($uid); |
|
| 465 | + if ($account->team) { |
|
| 466 | 466 | if (boincteam_is_founder($account->team, $account->uid)) { |
| 467 | - // Set a notice of any pending foundership requests |
|
| 468 | - $boincteam_id = boincteam_lookup_id($account->team); |
|
| 469 | - $boincteam = boincteam_load($boincteam_id); |
|
| 470 | - if ($boincteam->ping_user > 0) { |
|
| 467 | + // Set a notice of any pending foundership requests |
|
| 468 | + $boincteam_id = boincteam_lookup_id($account->team); |
|
| 469 | + $boincteam = boincteam_load($boincteam_id); |
|
| 470 | + if ($boincteam->ping_user > 0) { |
|
| 471 | 471 | $foundership_url = "community/teams/{$account->team}/edit/founder"; |
| 472 | 472 | if (substr($_GET['q'], 0, strlen($foundership_url)) != $foundership_url) { |
| 473 | - drupal_set_message( |
|
| 473 | + drupal_set_message( |
|
| 474 | 474 | bts( |
| 475 | - 'A foundership transfer request has been made for your team. Please !respond.', |
|
| 476 | - array('!respond' => l(bts('respond to the request', array(), NULL, 'boinc:team-founder-change'), $foundership_url)), |
|
| 477 | - NULL, 'boinc:team-founder-change'), |
|
| 475 | + 'A foundership transfer request has been made for your team. Please !respond.', |
|
| 476 | + array('!respond' => l(bts('respond to the request', array(), NULL, 'boinc:team-founder-change'), $foundership_url)), |
|
| 477 | + NULL, 'boinc:team-founder-change'), |
|
| 478 | 478 | 'warning', FALSE |
| 479 | - ); |
|
| 479 | + ); |
|
| 480 | + } |
|
| 480 | 481 | } |
| 481 | - } |
|
| 482 | 482 | } |
| 483 | - } |
|
| 483 | + } |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /** |
| 487 | 487 | * Add a user to a team |
| 488 | 488 | */ |
| 489 | 489 | function boincteam_join($team_id) { |
| 490 | - global $user; |
|
| 491 | - $account = user_load($user->uid); |
|
| 490 | + global $user; |
|
| 491 | + $account = user_load($user->uid); |
|
| 492 | 492 | |
| 493 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 494 | - $boincteam = boincteam_load($boincteam_id); |
|
| 495 | - if ($boincteam->joinable AND $account->team != $team_id) { |
|
| 493 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 494 | + $boincteam = boincteam_load($boincteam_id); |
|
| 495 | + if ($boincteam->joinable AND $account->team != $team_id) { |
|
| 496 | 496 | require_boinc('team'); |
| 497 | 497 | $boincuser = boincuser_load(); |
| 498 | 498 | if (user_join_team($boincteam, $boincuser)) { |
| 499 | - drupal_set_message(t('You are now a member of @team!', |
|
| 499 | + drupal_set_message(t('You are now a member of @team!', |
|
| 500 | 500 | array('@team' => $boincteam->name))); |
| 501 | - watchdog('boincteam', 'added user @uid to team @nid', |
|
| 501 | + watchdog('boincteam', 'added user @uid to team @nid', |
|
| 502 | 502 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
| 503 | 503 | } |
| 504 | 504 | else { |
| 505 | - drupal_set_message(t('There was a problem joining @team, please try again |
|
| 505 | + drupal_set_message(t('There was a problem joining @team, please try again |
|
| 506 | 506 | later', array('@team' => $boincteam->name))); |
| 507 | - watchdog('boincteam', 'error adding user @uid to team @nid', |
|
| 507 | + watchdog('boincteam', 'error adding user @uid to team @nid', |
|
| 508 | 508 | array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_ERROR); |
| 509 | 509 | } |
| 510 | - } |
|
| 511 | - drupal_goto("community/teams/{$team_id}"); |
|
| 510 | + } |
|
| 511 | + drupal_goto("community/teams/{$team_id}"); |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | /** |
| 515 | 515 | * Leave a team |
| 516 | 516 | */ |
| 517 | 517 | function boincteam_leave($team_id) { |
| 518 | - global $user; |
|
| 519 | - $account = user_load($user->uid); |
|
| 518 | + global $user; |
|
| 519 | + $account = user_load($user->uid); |
|
| 520 | 520 | |
| 521 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 522 | - $boincteam = boincteam_load($boincteam_id); |
|
| 523 | - if ($account->team == $team_id) { |
|
| 521 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 522 | + $boincteam = boincteam_load($boincteam_id); |
|
| 523 | + if ($account->team == $team_id) { |
|
| 524 | 524 | require_boinc('team'); |
| 525 | 525 | $boincuser = boincuser_load(); |
| 526 | 526 | user_quit_team($boincuser); |
| 527 | 527 | drupal_set_message(t('You are no longer a member of @team.', |
| 528 | - array('@team' => $boincteam->name))); |
|
| 528 | + array('@team' => $boincteam->name))); |
|
| 529 | 529 | watchdog('boincteam', 'removed user @uid from team @nid', |
| 530 | - array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
|
| 531 | - } |
|
| 532 | - else { |
|
| 533 | - drupal_set_message(t('You are not a member of @team, so you cannot revoke |
|
| 530 | + array('@uid' => $user->uid, '@nid' => $team_id), WATCHDOG_NOTICE); |
|
| 531 | + } |
|
| 532 | + else { |
|
| 533 | + drupal_set_message(t('You are not a member of @team, so you cannot revoke |
|
| 534 | 534 | your membership to it.', array('@team' => $boincteam->name))); |
| 535 | - } |
|
| 536 | - drupal_goto("community/teams/{$team_id}"); |
|
| 535 | + } |
|
| 536 | + drupal_goto("community/teams/{$team_id}"); |
|
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | /** |
| 540 | 540 | * Remove team admin status from a user |
| 541 | 541 | */ |
| 542 | 542 | function boincteam_remove_admin($team_id, $user_id) { |
| 543 | - global $user; |
|
| 544 | - $account = user_load($user_id); |
|
| 545 | - $team = node_load($team_id); |
|
| 546 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 547 | - $boincuser_id = $account->boincuser_id; |
|
| 543 | + global $user; |
|
| 544 | + $account = user_load($user_id); |
|
| 545 | + $team = node_load($team_id); |
|
| 546 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 547 | + $boincuser_id = $account->boincuser_id; |
|
| 548 | 548 | |
| 549 | - if (boincteam_is_admin($team_id, $account->uid)) { |
|
| 549 | + if (boincteam_is_admin($team_id, $account->uid)) { |
|
| 550 | 550 | // Update the team in the BOINC db |
| 551 | 551 | db_set_active('boinc_rw'); |
| 552 | 552 | db_query(" |
| 553 | 553 | DELETE FROM {team_admin} WHERE |
| 554 | 554 | teamid = '%d' AND userid = '%d'", |
| 555 | - $boincteam_id, |
|
| 556 | - $boincuser_id |
|
| 555 | + $boincteam_id, |
|
| 556 | + $boincuser_id |
|
| 557 | 557 | ); |
| 558 | 558 | db_set_active('default'); |
| 559 | 559 | drupal_set_message(t('@user is no longer an admin of @team.', |
| 560 | - array( |
|
| 560 | + array( |
|
| 561 | 561 | '@user' => $account->boincuser_name, |
| 562 | 562 | '@team' => $team->title |
| 563 | - ) |
|
| 563 | + ) |
|
| 564 | 564 | )); |
| 565 | 565 | watchdog('boincteam', 'User @current_user removed admin status for user |
| 566 | 566 | @uid from team @nid', |
| 567 | - array( |
|
| 567 | + array( |
|
| 568 | 568 | '@current_user' => $user->uid, |
| 569 | 569 | '@uid' => $account->uid, |
| 570 | 570 | '@nid' => $team_id |
| 571 | - ), WATCHDOG_NOTICE); |
|
| 572 | - } |
|
| 573 | - drupal_goto("community/teams/{$team_id}/edit/admins"); |
|
| 571 | + ), WATCHDOG_NOTICE); |
|
| 572 | + } |
|
| 573 | + drupal_goto("community/teams/{$team_id}/edit/admins"); |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | /** |
| 577 | 577 | * Remove a user from a team |
| 578 | 578 | */ |
| 579 | 579 | function boincteam_remove_member($team_id, $user_id) { |
| 580 | - global $user; |
|
| 581 | - $account = user_load($user_id); |
|
| 580 | + global $user; |
|
| 581 | + $account = user_load($user_id); |
|
| 582 | 582 | |
| 583 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 584 | - $boincteam = boincteam_load($boincteam_id); |
|
| 585 | - if ($account->team == $team_id) { |
|
| 583 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 584 | + $boincteam = boincteam_load($boincteam_id); |
|
| 585 | + if ($account->team == $team_id) { |
|
| 586 | 586 | require_boinc('team'); |
| 587 | 587 | $boincuser = boincuser_load($user_id, TRUE); |
| 588 | 588 | user_quit_team($boincuser); |
| 589 | 589 | drupal_set_message(t('@user has been removed from @team.', |
| 590 | - array( |
|
| 590 | + array( |
|
| 591 | 591 | '@user' => $account->boincuser_name, |
| 592 | 592 | '@team' => $boincteam->name |
| 593 | - ) |
|
| 593 | + ) |
|
| 594 | 594 | )); |
| 595 | 595 | watchdog('boincteam', 'User @current_user removed user @uid from team @nid', |
| 596 | - array( |
|
| 596 | + array( |
|
| 597 | 597 | '@current_user' => $user->uid, |
| 598 | 598 | '@uid' => $account->uid, |
| 599 | 599 | '@nid' => $team_id |
| 600 | - ), WATCHDOG_NOTICE); |
|
| 601 | - } |
|
| 602 | - else { |
|
| 603 | - drupal_set_message(t('@user is not a member of @team, so you cannot |
|
| 600 | + ), WATCHDOG_NOTICE); |
|
| 601 | + } |
|
| 602 | + else { |
|
| 603 | + drupal_set_message(t('@user is not a member of @team, so you cannot |
|
| 604 | 604 | revoke the membership.', array( |
| 605 | - '@user' => $account->boincuser_name, |
|
| 606 | - '@team' => $boincteam->name |
|
| 605 | + '@user' => $account->boincuser_name, |
|
| 606 | + '@team' => $boincteam->name |
|
| 607 | 607 | ) |
| 608 | - )); |
|
| 609 | - } |
|
| 610 | - drupal_goto("community/teams/{$team_id}/edit/members"); |
|
| 608 | + )); |
|
| 609 | + } |
|
| 610 | + drupal_goto("community/teams/{$team_id}/edit/members"); |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | /** |
| 614 | 614 | * Request a foundership transfer |
| 615 | 615 | */ |
| 616 | 616 | function boincteam_request_foundership($team_id) { |
| 617 | - global $user; |
|
| 618 | - $account = user_load($user->uid); |
|
| 619 | - $team = node_load($team_id); |
|
| 620 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 621 | - $boincteam = boincteam_load($boincteam_id); |
|
| 622 | - $boincuser_id = $account->boincuser_id; |
|
| 617 | + global $user; |
|
| 618 | + $account = user_load($user->uid); |
|
| 619 | + $team = node_load($team_id); |
|
| 620 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 621 | + $boincteam = boincteam_load($boincteam_id); |
|
| 622 | + $boincuser_id = $account->boincuser_id; |
|
| 623 | 623 | |
| 624 | - if (boincteam_is_founder($team_id, $account->uid)) { |
|
| 624 | + if (boincteam_is_founder($team_id, $account->uid)) { |
|
| 625 | 625 | // Shouldn't even be here... |
| 626 | 626 | drupal_set_message(t('@user is already the team founder.', |
| 627 | - array( |
|
| 627 | + array( |
|
| 628 | 628 | '@user' => $account->boincuser_name |
| 629 | - ) |
|
| 629 | + ) |
|
| 630 | 630 | ), 'warning'); |
| 631 | - } |
|
| 632 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
| 631 | + } |
|
| 632 | + elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
| 633 | 633 | // It hasn't been long enough since the last transfer request |
| 634 | 634 | drupal_set_message(t('A foundership change was requested during the last 90 |
| 635 | 635 | days, so new requests are not allowed. Please try again later.' |
| 636 | 636 | ), 'warning'); |
| 637 | - } |
|
| 638 | - elseif (boincteam_is_member($team_id, $account->uid)) { |
|
| 637 | + } |
|
| 638 | + elseif (boincteam_is_member($team_id, $account->uid)) { |
|
| 639 | 639 | // Log the transfer request |
| 640 | 640 | db_set_active('boinc_rw'); |
| 641 | 641 | db_query(" |
| 642 | 642 | UPDATE {team} |
| 643 | 643 | SET ping_user = '%d', ping_time='%d' |
| 644 | 644 | WHERE id = '%d'", |
| 645 | - $boincuser_id, time(), $boincteam_id |
|
| 645 | + $boincuser_id, time(), $boincteam_id |
|
| 646 | 646 | ); |
| 647 | 647 | db_set_active('default'); |
| 648 | 648 | drupal_set_message(t('You have requested foundership of @team. The current |
| 649 | 649 | founder has 60 days to respond to this request.', |
| 650 | - array( |
|
| 650 | + array( |
|
| 651 | 651 | '@team' => $team->title |
| 652 | - ) |
|
| 652 | + ) |
|
| 653 | 653 | )); |
| 654 | 654 | watchdog('boincteam', 'User @user requested foundership of team @nid', |
| 655 | - array( |
|
| 655 | + array( |
|
| 656 | 656 | '@current_user' => $account->uid, |
| 657 | 657 | '@nid' => $team_id |
| 658 | - ), WATCHDOG_NOTICE); |
|
| 659 | - } |
|
| 660 | - drupal_goto("community/teams/{$team_id}"); |
|
| 658 | + ), WATCHDOG_NOTICE); |
|
| 659 | + } |
|
| 660 | + drupal_goto("community/teams/{$team_id}"); |
|
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | /** |
| 664 | 664 | * Transfer foundership to another team member |
| 665 | 665 | */ |
| 666 | 666 | function boincteam_set_founder($team_id, $user_id) { |
| 667 | - global $user; |
|
| 668 | - $account = user_load($user_id); |
|
| 669 | - $team = node_load($team_id); |
|
| 670 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 671 | - $boincuser_id = $account->boincuser_id; |
|
| 667 | + global $user; |
|
| 668 | + $account = user_load($user_id); |
|
| 669 | + $team = node_load($team_id); |
|
| 670 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 671 | + $boincuser_id = $account->boincuser_id; |
|
| 672 | 672 | |
| 673 | - if (boincteam_is_member($team_id, $account->uid)) { |
|
| 673 | + if (boincteam_is_member($team_id, $account->uid)) { |
|
| 674 | 674 | // Update the team in the BOINC db |
| 675 | 675 | db_set_active('boinc_rw'); |
| 676 | 676 | db_query(" |
| 677 | 677 | UPDATE {team} |
| 678 | 678 | SET userid = '%d', ping_user=0 |
| 679 | 679 | WHERE id = '%d'", |
| 680 | - $boincuser_id, $boincteam_id |
|
| 680 | + $boincuser_id, $boincteam_id |
|
| 681 | 681 | ); |
| 682 | 682 | db_set_active('default'); |
| 683 | 683 | drupal_set_message(t('Foundership of @team has been transfered to @user.', |
| 684 | - array( |
|
| 684 | + array( |
|
| 685 | 685 | '@user' => $account->boincuser_name, |
| 686 | 686 | '@team' => $team->title |
| 687 | - ) |
|
| 687 | + ) |
|
| 688 | 688 | )); |
| 689 | 689 | watchdog('boincteam', 'User @current_user transferred foundership of team |
| 690 | 690 | @nid to user @uid', |
| 691 | - array( |
|
| 691 | + array( |
|
| 692 | 692 | '@current_user' => $user->uid, |
| 693 | 693 | '@uid' => $account->uid, |
| 694 | 694 | '@nid' => $team_id |
| 695 | - ), WATCHDOG_NOTICE); |
|
| 696 | - } |
|
| 697 | - drupal_goto("community/teams/{$team_id}"); |
|
| 695 | + ), WATCHDOG_NOTICE); |
|
| 696 | + } |
|
| 697 | + drupal_goto("community/teams/{$team_id}"); |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | /** |
| 701 | 701 | * See if a new foundership transfer request is allowed |
| 702 | 702 | */ |
| 703 | 703 | function boincteam_new_foundership_transfer_request_ok($team_id) { |
| 704 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 705 | - $boincteam = boincteam_load($boincteam_id); |
|
| 706 | - $now = time(); |
|
| 707 | - if ($boincteam->ping_user <= 0) { |
|
| 704 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 705 | + $boincteam = boincteam_load($boincteam_id); |
|
| 706 | + $now = time(); |
|
| 707 | + if ($boincteam->ping_user <= 0) { |
|
| 708 | 708 | if ($boincteam->ping_time < $now - 60 * (24*60*60)) { |
| 709 | - return TRUE; |
|
| 709 | + return TRUE; |
|
| 710 | 710 | } |
| 711 | 711 | return FALSE; |
| 712 | - } |
|
| 713 | - if ($boincteam->ping_time < $now - 90 * (24*60*60)) { |
|
| 712 | + } |
|
| 713 | + if ($boincteam->ping_time < $now - 90 * (24*60*60)) { |
|
| 714 | 714 | return TRUE; |
| 715 | - } |
|
| 716 | - return FALSE; |
|
| 715 | + } |
|
| 716 | + return FALSE; |
|
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | /** |
@@ -735,18 +735,18 @@ discard block |
||
| 735 | 735 | * Check if a user has an active foundership request with a team |
| 736 | 736 | */ |
| 737 | 737 | function boincteam_user_requested_foundership($team_id, $user_id = NULL) { |
| 738 | - if (!$user_id) { |
|
| 738 | + if (!$user_id) { |
|
| 739 | 739 | global $user; |
| 740 | 740 | $user_id = $user->uid; |
| 741 | - } |
|
| 742 | - $account = user_load($user_id); |
|
| 743 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 744 | - $boincteam = boincteam_load($boincteam_id); |
|
| 741 | + } |
|
| 742 | + $account = user_load($user_id); |
|
| 743 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 744 | + $boincteam = boincteam_load($boincteam_id); |
|
| 745 | 745 | |
| 746 | - if ($boincteam->ping_user == $account->boincuser_id) { |
|
| 746 | + if ($boincteam->ping_user == $account->boincuser_id) { |
|
| 747 | 747 | // Be sure the request is still active |
| 748 | 748 | return !boincteam_new_foundership_transfer_request_ok($team_id); |
| 749 | - } |
|
| 749 | + } |
|
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | |
@@ -758,125 +758,125 @@ discard block |
||
| 758 | 758 | * General info about team admins |
| 759 | 759 | */ |
| 760 | 760 | function boincteam_about_admins_panel() { |
| 761 | - $output = ''; |
|
| 762 | - $output .= '<h2 class="pane-title">' . bts('About team admins', array(), NULL, 'boinc:team-admins-panel') . '</h2>'; |
|
| 763 | - $output .= '<div>'; |
|
| 764 | - $output .= '<p>' . bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
| 765 | - $output .= '<ul>'; |
|
| 766 | - $output .= ' <li>' . bts('Edit team information', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 767 | - $output .= ' <li>' . bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 768 | - $output .= ' <li>' . bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 769 | - $output .= ' <li>' . bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 770 | - $output .= ' <li>' . bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 771 | - $output .= '</ul>'; |
|
| 772 | - $output .= '</div>'; |
|
| 773 | - $output .= '<div>'; |
|
| 774 | - $output .= '<p>' . bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
| 775 | - $output .= '<ul>'; |
|
| 776 | - $output .= ' <li>' . bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 777 | - $output .= ' <li>' . bts('Remove members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 778 | - $output .= ' <li>' . bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 779 | - $output .= '</ul>'; |
|
| 780 | - $output .= '</div>'; |
|
| 781 | - $output .= '<p>' . bts('If a team admin quits the team, they cease to be a' |
|
| 761 | + $output = ''; |
|
| 762 | + $output .= '<h2 class="pane-title">' . bts('About team admins', array(), NULL, 'boinc:team-admins-panel') . '</h2>'; |
|
| 763 | + $output .= '<div>'; |
|
| 764 | + $output .= '<p>' . bts('Team admins can:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
| 765 | + $output .= '<ul>'; |
|
| 766 | + $output .= ' <li>' . bts('Edit team information', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 767 | + $output .= ' <li>' . bts("View the team's join / quit history", array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 768 | + $output .= ' <li>' . bts('Moderate the team forum', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 769 | + $output .= ' <li>' . bts('Remove members from the team', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 770 | + $output .= ' <li>' . bts('Disband a team if it has no members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 771 | + $output .= '</ul>'; |
|
| 772 | + $output .= '</div>'; |
|
| 773 | + $output .= '<div>'; |
|
| 774 | + $output .= '<p>' . bts('Team admins cannot:', array(), NULL, 'boinc:team-admins-panel') . '</p>'; |
|
| 775 | + $output .= '<ul>'; |
|
| 776 | + $output .= ' <li>' . bts('Change the team founder', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 777 | + $output .= ' <li>' . bts('Remove members', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 778 | + $output .= ' <li>' . bts('Add / Remove team admins', array(), NULL, 'boinc:team-admins-panel') . '</li>'; |
|
| 779 | + $output .= '</ul>'; |
|
| 780 | + $output .= '</div>'; |
|
| 781 | + $output .= '<p>' . bts('If a team admin quits the team, they cease to be a' |
|
| 782 | 782 | . ' team admin. We recommend only selecting people you know and trust', array(), NULL, 'boinc:team-admins-panel') |
| 783 | 783 | . '</p>'; |
| 784 | - return $output; |
|
| 784 | + return $output; |
|
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | /** |
| 788 | 788 | * General info about changing the team founder |
| 789 | 789 | */ |
| 790 | 790 | function boincteam_about_founder_panel() { |
| 791 | - $output = ''; |
|
| 792 | - $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
| 791 | + $output = ''; |
|
| 792 | + $output .= '<h2 class="pane-title">' . bts('Changing the team founder', array(), NULL, 'boinc:team-founder-panel') |
|
| 793 | 793 | . '</h2>'; |
| 794 | - $output .= '<div>'; |
|
| 795 | - $output .= '<p>' . bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel') . '</p>'; |
|
| 796 | - $output .= '<ul>'; |
|
| 797 | - $output .= ' <li>' . bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
| 798 | - $output .= ' <li>' . bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
| 799 | - $output .= '</ul>'; |
|
| 800 | - $output .= '</div>'; |
|
| 801 | - $output .= '<div>'; |
|
| 802 | - $output .= '<p>' . bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
| 794 | + $output .= '<div>'; |
|
| 795 | + $output .= '<p>' . bts('Notes about changes in foundership:', array(), NULL, 'boinc:team-founder-panel') . '</p>'; |
|
| 796 | + $output .= '<ul>'; |
|
| 797 | + $output .= ' <li>' . bts('Any member of the team is eligible', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
| 798 | + $output .= ' <li>' . bts('Current founder becomes a normal user', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
| 799 | + $output .= '</ul>'; |
|
| 800 | + $output .= '</div>'; |
|
| 801 | + $output .= '<div>'; |
|
| 802 | + $output .= '<p>' . bts('Foundership can be requested by team members:', array(), NULL, 'boinc:team-founder-panel') |
|
| 803 | 803 | . '</p>'; |
| 804 | - $output .= '<ul>'; |
|
| 805 | - $output .= ' <li>' . bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
| 806 | - $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
| 804 | + $output .= '<ul>'; |
|
| 805 | + $output .= ' <li>' . bts('One request is allowed at a time', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
|
| 806 | + $output .= ' <li>' . bts('It must be 60 days since any previous request', array(), NULL, 'boinc:team-founder-panel') |
|
| 807 | 807 | . '</li>'; |
| 808 | - $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
| 808 | + $output .= ' <li>' . bts('Any active request must be older than 90 days', array(), NULL, 'boinc:team-founder-panel') |
|
| 809 | 809 | . '</li>'; |
| 810 | - $output .= ' <li>' . bts('Current founder has 60 days to respond to a' |
|
| 810 | + $output .= ' <li>' . bts('Current founder has 60 days to respond to a' |
|
| 811 | 811 | . ' request', array(), NULL, 'boinc:team-founder-panel') . '</li>'; |
| 812 | - $output .= '</ul>'; |
|
| 813 | - $output .= '</div>'; |
|
| 814 | - return $output; |
|
| 812 | + $output .= '</ul>'; |
|
| 813 | + $output .= '</div>'; |
|
| 814 | + return $output; |
|
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | /** |
| 818 | 818 | * Link to create a new team |
| 819 | 819 | */ |
| 820 | 820 | function boincteam_create_team_link_panel() { |
| 821 | - global $user; |
|
| 822 | - $account = user_load($user->uid); |
|
| 823 | - $unrestricted_role = array_search('verified contributor', user_roles(true)); |
|
| 824 | - $output = ''; |
|
| 825 | - $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
| 826 | - $output .= '<p>' . bts('If you cannot find a team that is right for you, you' |
|
| 821 | + global $user; |
|
| 822 | + $account = user_load($user->uid); |
|
| 823 | + $unrestricted_role = array_search('verified contributor', user_roles(true)); |
|
| 824 | + $output = ''; |
|
| 825 | + $output .= '<h2 class="pane-title">' . bts('Create a new team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
| 826 | + $output .= '<p>' . bts('If you cannot find a team that is right for you, you' |
|
| 827 | 827 | . ' can create a team.', array(), NULL, 'boinc:create-team-panel') . '</p>'; |
| 828 | - $output .= '<ul class="tab-list">'; |
|
| 829 | - $output .= ' <li class="first last tab">'; |
|
| 830 | - if (isset($account->roles[$unrestricted_role])) { |
|
| 828 | + $output .= '<ul class="tab-list">'; |
|
| 829 | + $output .= ' <li class="first last tab">'; |
|
| 830 | + if (isset($account->roles[$unrestricted_role])) { |
|
| 831 | 831 | $output .= l(bts('Create new team', array(), NULL, 'boinc:create-team-panel'), 'community/teams/add'); |
| 832 | - } elseif ($account->uid <= 0) { |
|
| 832 | + } elseif ($account->uid <= 0) { |
|
| 833 | 833 | $output .= l( |
| 834 | - bts('Login to create a new team', array(), NULL, 'boinc:create-team-panel'), |
|
| 835 | - 'user/login', |
|
| 836 | - array('query' => drupal_get_destination()) |
|
| 834 | + bts('Login to create a new team', array(), NULL, 'boinc:create-team-panel'), |
|
| 835 | + 'user/login', |
|
| 836 | + array('query' => drupal_get_destination()) |
|
| 837 | 837 | ); |
| 838 | - } else { |
|
| 838 | + } else { |
|
| 839 | 839 | $min_credit_needed = variable_get('boinc_comment_min_credit', 0); |
| 840 | 840 | $credit_needed = $min_credit_needed - $account->boincuser_total_credit; |
| 841 | 841 | $output .= '['; |
| 842 | 842 | if ($credit_needed == 1) { |
| 843 | - $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
|
| 843 | + $output .= bts('You must earn 1 more credit!', array(), NULL, 'boinc:create-team-panel'); |
|
| 844 | 844 | } |
| 845 | 845 | else { |
| 846 | - $output .= bts('You must earn @count more credits!', |
|
| 846 | + $output .= bts('You must earn @count more credits!', |
|
| 847 | 847 | array('@count' => $credit_needed), |
| 848 | - NULL, 'boinc:create-team-panel' |
|
| 849 | - ); |
|
| 848 | + NULL, 'boinc:create-team-panel' |
|
| 849 | + ); |
|
| 850 | 850 | } |
| 851 | 851 | $output .= ']'; |
| 852 | - } |
|
| 853 | - $output .= ' </li>'; |
|
| 854 | - $output .= '</ul>'; |
|
| 855 | - return $output; |
|
| 852 | + } |
|
| 853 | + $output .= ' </li>'; |
|
| 854 | + $output .= '</ul>'; |
|
| 855 | + return $output; |
|
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | /** |
| 859 | 859 | * Create team form |
| 860 | 860 | */ |
| 861 | 861 | function boincteam_create_team_panel() { |
| 862 | - $output = ''; |
|
| 863 | - $output .= '<h2 class="pane-title">' . bts('Create a team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
| 864 | - $output .= drupal_get_form('boincteam_create_form'); |
|
| 862 | + $output = ''; |
|
| 863 | + $output .= '<h2 class="pane-title">' . bts('Create a team', array(), NULL, 'boinc:create-team-panel') . '</h2>'; |
|
| 864 | + $output .= drupal_get_form('boincteam_create_form'); |
|
| 865 | 865 | |
| 866 | - return $output; |
|
| 866 | + return $output; |
|
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | /** |
| 870 | 870 | * Link to user's team |
| 871 | 871 | */ |
| 872 | 872 | function boincteam_dashboard_panel($uid = NULL) { |
| 873 | - global $user; |
|
| 874 | - if (!$uid) { |
|
| 873 | + global $user; |
|
| 874 | + if (!$uid) { |
|
| 875 | 875 | $uid = $user->uid; |
| 876 | - } |
|
| 877 | - $output = ''; |
|
| 878 | - $account = user_load($uid); |
|
| 879 | - if ($account->team) { |
|
| 876 | + } |
|
| 877 | + $output = ''; |
|
| 878 | + $account = user_load($uid); |
|
| 879 | + if ($account->team) { |
|
| 880 | 880 | $team = boincteam_load(boincteam_lookup_id($account->team)); |
| 881 | 881 | $output .= '<h2 class="pane-title">' . bts('Team', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
| 882 | 882 | $output .= '<div class="stats">'; |
@@ -895,87 +895,87 @@ discard block |
||
| 895 | 895 | $output .= ' <label>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': </label>'; |
| 896 | 896 | $output .= ' <span>' . number_format($team->total_credit, 0) . '</span>'; |
| 897 | 897 | $output .= '</div>' . "\n"; |
| 898 | - } |
|
| 899 | - else if ($user->uid == $account->uid) { |
|
| 898 | + } |
|
| 899 | + else if ($user->uid == $account->uid) { |
|
| 900 | 900 | $output .= '<h2 class="pane-title">' . bts('Team (None)', array(), NULL, 'boinc:team-dashboard') . '</h2>'; |
| 901 | 901 | $output .= '<ul class="tab-list action-list">'; |
| 902 | 902 | $output .= '<li class="tab primary">'; |
| 903 | 903 | $output .= l(bts('Join a Team', array(), NULL, 'boinc:team-dashboard'), 'community/teams'); |
| 904 | 904 | $output .= '</li>'; |
| 905 | 905 | $output .= '</ul>'; |
| 906 | - } |
|
| 907 | - return $output; |
|
| 906 | + } |
|
| 907 | + return $output; |
|
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | /** |
| 911 | 911 | * Edit team form |
| 912 | 912 | */ |
| 913 | 913 | function boincteam_edit_team_panel($team_id) { |
| 914 | - $team = node_load($team_id); |
|
| 915 | - $output = ''; |
|
| 916 | - $output .= '<h2 class="pane-title">' . $team->title . '</h2>'; |
|
| 917 | - $output .= drupal_get_form('boincteam_edit_form', $team_id); |
|
| 914 | + $team = node_load($team_id); |
|
| 915 | + $output = ''; |
|
| 916 | + $output .= '<h2 class="pane-title">' . $team->title . '</h2>'; |
|
| 917 | + $output .= drupal_get_form('boincteam_edit_form', $team_id); |
|
| 918 | 918 | |
| 919 | - return $output; |
|
| 919 | + return $output; |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | /** |
| 923 | 923 | * Link to join a team |
| 924 | 924 | */ |
| 925 | 925 | function boincteam_join_team_panel($team_id) { |
| 926 | - $team = node_load($team_id); |
|
| 927 | - $output = ''; |
|
| 928 | - $output .= '<h2 class="pane-title">' . bts('Join team', array(), NULL, 'boinc:join-team-panel') . '</h2>'; |
|
| 929 | - $output .= '<p>' . bts('Click here to become a member of @this_team', |
|
| 926 | + $team = node_load($team_id); |
|
| 927 | + $output = ''; |
|
| 928 | + $output .= '<h2 class="pane-title">' . bts('Join team', array(), NULL, 'boinc:join-team-panel') . '</h2>'; |
|
| 929 | + $output .= '<p>' . bts('Click here to become a member of @this_team', |
|
| 930 | 930 | array('@this_team' =>$team->title), NULL, 'boinc:join-team-panel') . '</p>'; |
| 931 | - $output .= '<ul class="tab-list">'; |
|
| 932 | - $output .= ' <li class="first last tab">' . |
|
| 931 | + $output .= '<ul class="tab-list">'; |
|
| 932 | + $output .= ' <li class="first last tab">' . |
|
| 933 | 933 | l(bts('Join this team', array(), NULL, 'boinc:join-team-panel'), "community/teams/{$team_id}/join") . '</li>'; |
| 934 | - $output .= '</ul>'; |
|
| 935 | - return $output; |
|
| 934 | + $output .= '</ul>'; |
|
| 935 | + return $output; |
|
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | /** |
| 939 | 939 | * Link to leave a team |
| 940 | 940 | */ |
| 941 | 941 | function boincteam_leave_team_panel($team_id) { |
| 942 | - $team = node_load($team_id); |
|
| 943 | - $output = ''; |
|
| 944 | - $output .= '<h2 class="pane-title">' . bts('Leave team', array(), NULL, 'boinc:leave-team-panel') . '</h2>'; |
|
| 945 | - $output .= '<p>' . bts('Click here to revoke your membership with' |
|
| 942 | + $team = node_load($team_id); |
|
| 943 | + $output = ''; |
|
| 944 | + $output .= '<h2 class="pane-title">' . bts('Leave team', array(), NULL, 'boinc:leave-team-panel') . '</h2>'; |
|
| 945 | + $output .= '<p>' . bts('Click here to revoke your membership with' |
|
| 946 | 946 | . ' @this_team', array('@this_team' =>$team->title), NULL, 'boinc:leave-team-panel') . '</p>'; |
| 947 | - $output .= '<ul class="tab-list">'; |
|
| 948 | - $output .= ' <li class="first last tab">' . |
|
| 947 | + $output .= '<ul class="tab-list">'; |
|
| 948 | + $output .= ' <li class="first last tab">' . |
|
| 949 | 949 | l(bts('Leave this team', array(), NULL, 'boinc:leave-team-panel'), "community/teams/{$team_id}/leave") . '</li>'; |
| 950 | - $output .= '</ul>'; |
|
| 951 | - return $output; |
|
| 950 | + $output .= '</ul>'; |
|
| 951 | + return $output; |
|
| 952 | 952 | } |
| 953 | 953 | |
| 954 | 954 | /** |
| 955 | 955 | * General info about team admins |
| 956 | 956 | */ |
| 957 | 957 | function boincteam_manage_admins_panel_header($team_id) { |
| 958 | - $output = ''; |
|
| 959 | - $output .= '<h4>' . bts('Add team admin', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
| 960 | - $output .= drupal_get_form('boincteam_add_admin_form', $team_id); |
|
| 961 | - $output .= '<div class="clearfix"></div>'; |
|
| 962 | - $output .= '<h4>' . bts('Current team admins', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
| 958 | + $output = ''; |
|
| 959 | + $output .= '<h4>' . bts('Add team admin', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
| 960 | + $output .= drupal_get_form('boincteam_add_admin_form', $team_id); |
|
| 961 | + $output .= '<div class="clearfix"></div>'; |
|
| 962 | + $output .= '<h4>' . bts('Current team admins', array(), NULL, 'boinc:team-manage-admins') . '</h4>'; |
|
| 963 | 963 | |
| 964 | - return $output; |
|
| 964 | + return $output; |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | /** |
| 968 | 968 | * Team management tools |
| 969 | 969 | */ |
| 970 | 970 | function boincteam_management_panel($team_id) { |
| 971 | - $is_founder = boincteam_is_founder($team_id); |
|
| 972 | - $team = node_load($team_id); |
|
| 971 | + $is_founder = boincteam_is_founder($team_id); |
|
| 972 | + $team = node_load($team_id); |
|
| 973 | 973 | |
| 974 | - $output = ''; |
|
| 975 | - $output .= '<h2 class="pane-title">' . bts('Manage team', array(), NULL, 'boinc:team-manage') . '</h2>'; |
|
| 974 | + $output = ''; |
|
| 975 | + $output .= '<h2 class="pane-title">' . bts('Manage team', array(), NULL, 'boinc:team-manage') . '</h2>'; |
|
| 976 | 976 | |
| 977 | - // PM all members |
|
| 978 | - if (module_exists('privatemsg')) { |
|
| 977 | + // PM all members |
|
| 978 | + if (module_exists('privatemsg')) { |
|
| 979 | 979 | // Obtain all Drupal uids of team members and construct URL to send |
| 980 | 980 | // a private message to all. |
| 981 | 981 | $boinc_id = boincteam_lookup_id($team_id); |
@@ -986,170 +986,170 @@ discard block |
||
| 986 | 986 | $output .= '<div class="form-item">'; |
| 987 | 987 | $output .= ' <ul class="tab-list action-list">'; |
| 988 | 988 | $output .= ' <li class="first tab primary">' . |
| 989 | - l('Send message to team', $team_pm_link) . '</li>'; |
|
| 989 | + l('Send message to team', $team_pm_link) . '</li>'; |
|
| 990 | 990 | $output .= ' </ul>'; |
| 991 | 991 | $output .= ' <div class="description">'; |
| 992 | 992 | $output .= bts('Private message all team members.', array(), NULL, 'boinc:team-manage'); |
| 993 | 993 | $output .= ' </div>'; |
| 994 | 994 | $output .= '</div>'; |
| 995 | - } |
|
| 995 | + } |
|
| 996 | 996 | |
| 997 | - // Team forum |
|
| 998 | - if (module_exists('boincteam_forum')) { |
|
| 997 | + // Team forum |
|
| 998 | + if (module_exists('boincteam_forum')) { |
|
| 999 | 999 | if ($is_founder) { |
| 1000 | - // Determine whether to create a forum or edit the existing forum |
|
| 1001 | - // (multiple forums per team could be supported in the future) |
|
| 1002 | - $team_forum_link_path = 'add'; |
|
| 1003 | - $team_forums = boincteam_forum_list(); |
|
| 1004 | - if ($team_forums) { |
|
| 1000 | + // Determine whether to create a forum or edit the existing forum |
|
| 1001 | + // (multiple forums per team could be supported in the future) |
|
| 1002 | + $team_forum_link_path = 'add'; |
|
| 1003 | + $team_forums = boincteam_forum_list(); |
|
| 1004 | + if ($team_forums) { |
|
| 1005 | 1005 | $team_forum = reset($team_forums); |
| 1006 | 1006 | $team_forum_link_path = "{$team_forum->tfid}/edit"; |
| 1007 | - } |
|
| 1008 | - $output .= '<div class="form-item">'; |
|
| 1009 | - $output .= ' <ul class="tab-list action-list">'; |
|
| 1010 | - $output .= ' <li class="first tab primary">' . |
|
| 1007 | + } |
|
| 1008 | + $output .= '<div class="form-item">'; |
|
| 1009 | + $output .= ' <ul class="tab-list action-list">'; |
|
| 1010 | + $output .= ' <li class="first tab primary">' . |
|
| 1011 | 1011 | l(bts('Manage team message board', array(), NULL, 'boinc:team-manage'), |
| 1012 | - "community/teams/{$team_id}/forum/{$team_forum_link_path}" |
|
| 1012 | + "community/teams/{$team_id}/forum/{$team_forum_link_path}" |
|
| 1013 | 1013 | ); |
| 1014 | - $output .= ' </li>'; |
|
| 1015 | - $output .= ' <div class="description">'; |
|
| 1016 | - $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
| 1017 | - $output .= ' </div>'; |
|
| 1018 | - $output .= '</div>'; |
|
| 1014 | + $output .= ' </li>'; |
|
| 1015 | + $output .= ' <div class="description">'; |
|
| 1016 | + $output .= bts('Create or manage message board', array(), NULL, 'boinc:team-manage'); |
|
| 1017 | + $output .= ' </div>'; |
|
| 1018 | + $output .= '</div>'; |
|
| 1019 | + } |
|
| 1019 | 1020 | } |
| 1020 | - } |
|
| 1021 | 1021 | |
| 1022 | - // Team history |
|
| 1023 | - $output .= '<div class="form-item">'; |
|
| 1024 | - $output .= ' <label>' . bts('View change history', array(), NULL, 'boinc:team-manage') . '</label>'; |
|
| 1025 | - $output .= ' <ul class="tab-list">'; |
|
| 1026 | - $output .= ' <li class="first tab primary">' . |
|
| 1022 | + // Team history |
|
| 1023 | + $output .= '<div class="form-item">'; |
|
| 1024 | + $output .= ' <label>' . bts('View change history', array(), NULL, 'boinc:team-manage') . '</label>'; |
|
| 1025 | + $output .= ' <ul class="tab-list">'; |
|
| 1026 | + $output .= ' <li class="first tab primary">' . |
|
| 1027 | 1027 | l('HTML', "community/teams/{$team_id}/history") . '</li>'; |
| 1028 | - $output .= ' <li class="last tab primary">' . |
|
| 1028 | + $output .= ' <li class="last tab primary">' . |
|
| 1029 | 1029 | l('XML', "community/teams/{$team_id}/history/xml") . '</li>'; |
| 1030 | - $output .= ' </ul>'; |
|
| 1031 | - $output .= ' <div class="description">'; |
|
| 1032 | - $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
| 1033 | - $output .= ' </div>'; |
|
| 1034 | - $output .= '</div>'; |
|
| 1030 | + $output .= ' </ul>'; |
|
| 1031 | + $output .= ' <div class="description">'; |
|
| 1032 | + $output .= bts('See member activity', array(), NULL, 'boinc:team-manage'); |
|
| 1033 | + $output .= ' </div>'; |
|
| 1034 | + $output .= '</div>'; |
|
| 1035 | 1035 | |
| 1036 | - $output .= '<div class="form-item">'; |
|
| 1037 | - $output .= ' <ul class="tab-list action-list">'; |
|
| 1036 | + $output .= '<div class="form-item">'; |
|
| 1037 | + $output .= ' <ul class="tab-list action-list">'; |
|
| 1038 | 1038 | |
| 1039 | - // Edit team information |
|
| 1040 | - $output .= ' <li class="first tab primary">' . |
|
| 1039 | + // Edit team information |
|
| 1040 | + $output .= ' <li class="first tab primary">' . |
|
| 1041 | 1041 | l(bts('Edit team info', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/info") . '</li>'; |
| 1042 | 1042 | |
| 1043 | - // Member list |
|
| 1044 | - $output .= ' <li class="tab primary">' . |
|
| 1043 | + // Member list |
|
| 1044 | + $output .= ' <li class="tab primary">' . |
|
| 1045 | 1045 | l(bts('View member list', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/members") . '</li>'; |
| 1046 | 1046 | |
| 1047 | - // Remove members |
|
| 1048 | - $output .= ' <li class="tab primary">' . |
|
| 1047 | + // Remove members |
|
| 1048 | + $output .= ' <li class="tab primary">' . |
|
| 1049 | 1049 | l(bts('Remove members', array(), NULL, 'boinc:team-admins-panel'), "community/teams/{$team_id}/edit/members") . '</li>'; |
| 1050 | 1050 | |
| 1051 | - if ($is_founder) { |
|
| 1051 | + if ($is_founder) { |
|
| 1052 | 1052 | |
| 1053 | 1053 | // Change founder |
| 1054 | 1054 | $output .= ' <li class="tab primary">' . |
| 1055 | - l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
| 1055 | + l(bts('Change founder', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/founder") . '</li>'; |
|
| 1056 | 1056 | |
| 1057 | - // Manage admins |
|
| 1057 | + // Manage admins |
|
| 1058 | 1058 | $output .= ' <li class="tab primary">' . |
| 1059 | - l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
| 1059 | + l(bts('Manage team admins', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/edit/admins") . '</li>'; |
|
| 1060 | 1060 | |
| 1061 | 1061 | // Delete the team |
| 1062 | 1062 | $output .= ' <li class="last tab primary">' . |
| 1063 | - l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
| 1064 | - } |
|
| 1063 | + l(bts('Remove team', array(), NULL, 'boinc:team-manage'), "community/teams/{$team_id}/delete") . '</li>'; |
|
| 1064 | + } |
|
| 1065 | 1065 | |
| 1066 | - $output .= ' </ul>'; |
|
| 1067 | - $output .= '</div>'; |
|
| 1066 | + $output .= ' </ul>'; |
|
| 1067 | + $output .= '</div>'; |
|
| 1068 | 1068 | |
| 1069 | - return $output; |
|
| 1069 | + return $output; |
|
| 1070 | 1070 | } |
| 1071 | 1071 | |
| 1072 | 1072 | /** |
| 1073 | 1073 | * Link to user's team |
| 1074 | 1074 | */ |
| 1075 | 1075 | function boincteam_member_link_panel() { |
| 1076 | - global $user; |
|
| 1077 | - $account = user_load($user->uid); |
|
| 1078 | - $team = node_load($account->team); |
|
| 1079 | - $output = ''; |
|
| 1080 | - $output .= '<h2 class="pane-title">' . bts('My team', array(), NULL, 'boinc:account-team-panel') . '</h2>'; |
|
| 1081 | - $output .= '<p>' . bts('You are a member of @team.', |
|
| 1076 | + global $user; |
|
| 1077 | + $account = user_load($user->uid); |
|
| 1078 | + $team = node_load($account->team); |
|
| 1079 | + $output = ''; |
|
| 1080 | + $output .= '<h2 class="pane-title">' . bts('My team', array(), NULL, 'boinc:account-team-panel') . '</h2>'; |
|
| 1081 | + $output .= '<p>' . bts('You are a member of @team.', |
|
| 1082 | 1082 | array('@team' => $team->title), NULL, 'boinc:account-team-panel') . '</p>'; |
| 1083 | - $output .= '<ul class="tab-list">'; |
|
| 1084 | - $output .= ' <li class="first last tab">' . |
|
| 1083 | + $output .= '<ul class="tab-list">'; |
|
| 1084 | + $output .= ' <li class="first last tab">' . |
|
| 1085 | 1085 | l(bts('View my team', array(), NULL, 'boinc:account-team-panel'), "community/teams/{$account->team}") . '</li>'; |
| 1086 | - $output .= '</ul>'; |
|
| 1087 | - return $output; |
|
| 1086 | + $output .= '</ul>'; |
|
| 1087 | + return $output; |
|
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | /** |
| 1091 | 1091 | * Link to request foundership transfer of a team |
| 1092 | 1092 | */ |
| 1093 | 1093 | function boincteam_request_foundership_panel($team_id) { |
| 1094 | - global $user; |
|
| 1095 | - $account = user_load($user->uid); |
|
| 1096 | - $team = node_load($team_id); |
|
| 1097 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 1098 | - $boincteam = boincteam_load($boincteam_id); |
|
| 1099 | - $boincuser_id = $account->boincuser_id; |
|
| 1100 | - $output = ''; |
|
| 1101 | - $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), NULL, 'boinc:team-request-foundership') . '</h2>'; |
|
| 1094 | + global $user; |
|
| 1095 | + $account = user_load($user->uid); |
|
| 1096 | + $team = node_load($team_id); |
|
| 1097 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 1098 | + $boincteam = boincteam_load($boincteam_id); |
|
| 1099 | + $boincuser_id = $account->boincuser_id; |
|
| 1100 | + $output = ''; |
|
| 1101 | + $output .= '<h2 class="pane-title">' . bts('Request foundership', array(), NULL, 'boinc:team-request-foundership') . '</h2>'; |
|
| 1102 | 1102 | |
| 1103 | - if (boincteam_user_requested_foundership($team_id)) { |
|
| 1103 | + if (boincteam_user_requested_foundership($team_id)) { |
|
| 1104 | 1104 | $deadline = boincteam_foundership_transfer_ok_time($boincteam); |
| 1105 | 1105 | $days_to_deadline = ceil(($deadline - time()) / (24*60*60)); |
| 1106 | 1106 | $request_age = 60 - $days_to_deadline; |
| 1107 | 1107 | $days_to_respond = 30 + $days_to_deadline; |
| 1108 | 1108 | if (time() > $deadline) { |
| 1109 | - $output .= '<p>'; |
|
| 1110 | - if ($request_age == 1) { |
|
| 1109 | + $output .= '<p>'; |
|
| 1110 | + if ($request_age == 1) { |
|
| 1111 | 1111 | $output .= bts('1 day has elapsed since your request and' |
| 1112 | - . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
|
| 1113 | - } |
|
| 1114 | - else { |
|
| 1112 | + . ' the founder has not responded.', array(), NULL, 'boinc:team-request-foundership'); |
|
| 1113 | + } |
|
| 1114 | + else { |
|
| 1115 | 1115 | $output .= bts('@count days have elapsed since your request and' |
| 1116 | - . ' the founder has not responded.', |
|
| 1117 | - array('@count' => $request_age), |
|
| 1118 | - NULL, 'boinc:team-request-foundership'); |
|
| 1119 | - } |
|
| 1120 | - $output .= ' '; |
|
| 1121 | - if ($days_to_respond == 1) { |
|
| 1116 | + . ' the founder has not responded.', |
|
| 1117 | + array('@count' => $request_age), |
|
| 1118 | + NULL, 'boinc:team-request-foundership'); |
|
| 1119 | + } |
|
| 1120 | + $output .= ' '; |
|
| 1121 | + if ($days_to_respond == 1) { |
|
| 1122 | 1122 | $output .= bts('You now have 1 day to assume foundership before' |
| 1123 | - . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
|
| 1124 | - } |
|
| 1125 | - else { |
|
| 1123 | + . ' another team member may submit a request.', array(), NULL, 'boinc:team-request-foundership'); |
|
| 1124 | + } |
|
| 1125 | + else { |
|
| 1126 | 1126 | $output .= bts('You now have @count days to assume foundership before' |
| 1127 | - . ' another team member may submit a request.', |
|
| 1128 | - array('@count' => $days_to_respond), |
|
| 1129 | - NULL, 'boinc:team-request-foundership'); |
|
| 1130 | - } |
|
| 1131 | - $output .= '</p>'; |
|
| 1132 | - $output .= '<ul class="tab-list">'; |
|
| 1133 | - $output .= ' <li class="first last tab">' . |
|
| 1127 | + . ' another team member may submit a request.', |
|
| 1128 | + array('@count' => $days_to_respond), |
|
| 1129 | + NULL, 'boinc:team-request-foundership'); |
|
| 1130 | + } |
|
| 1131 | + $output .= '</p>'; |
|
| 1132 | + $output .= '<ul class="tab-list">'; |
|
| 1133 | + $output .= ' <li class="first last tab">' . |
|
| 1134 | 1134 | l(bts('Assume foundership', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/assume-foundership") . '</li>'; |
| 1135 | - $output .= '</ul>'; |
|
| 1135 | + $output .= '</ul>'; |
|
| 1136 | 1136 | } |
| 1137 | 1137 | else { |
| 1138 | - $output .= '<p>'; |
|
| 1139 | - if ($days_to_deadline == 1) { |
|
| 1138 | + $output .= '<p>'; |
|
| 1139 | + if ($days_to_deadline == 1) { |
|
| 1140 | 1140 | $output .= bts('The team founder has 1 day to respond to your' |
| 1141 | - . ' transfer request.', |
|
| 1142 | - NULL, 'boinc:team-request-foundership'); |
|
| 1143 | - } |
|
| 1144 | - else { |
|
| 1141 | + . ' transfer request.', |
|
| 1142 | + NULL, 'boinc:team-request-foundership'); |
|
| 1143 | + } |
|
| 1144 | + else { |
|
| 1145 | 1145 | $output .= bts('The team founder has @count days to respond to your' |
| 1146 | - . ' transfer request.', array('@count' => $days_to_deadline), |
|
| 1147 | - NULL, 'boinc:team-request-foundership'); |
|
| 1148 | - } |
|
| 1149 | - $output .= '</p>'; |
|
| 1146 | + . ' transfer request.', array('@count' => $days_to_deadline), |
|
| 1147 | + NULL, 'boinc:team-request-foundership'); |
|
| 1148 | + } |
|
| 1149 | + $output .= '</p>'; |
|
| 1150 | 1150 | } |
| 1151 | - } |
|
| 1152 | - elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
| 1151 | + } |
|
| 1152 | + elseif (!boincteam_new_foundership_transfer_request_ok($team_id)) { |
|
| 1153 | 1153 | // If this user does not have a transfer request pending, but new requests |
| 1154 | 1154 | // are not allowed, set the deadline to 90 days instead of 60 (as the user |
| 1155 | 1155 | // who made the request has 30 additional days to assume foundership if |
@@ -1158,131 +1158,131 @@ discard block |
||
| 1158 | 1158 | $days_to_deadline = ceil(($deadline - time()) / (24*60*60)) + 30; |
| 1159 | 1159 | $output .= '<p>'; |
| 1160 | 1160 | $output .= bts('A team foundership change was already requested recently.' |
| 1161 | - . ' Only one request is allowed within a period of 90 days.', |
|
| 1162 | - NULL, 'boinc:team-request-foundership'); |
|
| 1161 | + . ' Only one request is allowed within a period of 90 days.', |
|
| 1162 | + NULL, 'boinc:team-request-foundership'); |
|
| 1163 | 1163 | if ($days_to_deadline == 1) { |
| 1164 | - $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
|
| 1164 | + $output .= ' (' . bts('1 day remaining', array(), NULL, 'boinc:team-request-foundership') . ')'; |
|
| 1165 | 1165 | } |
| 1166 | 1166 | else { |
| 1167 | - $output .= ' (' . bts('@count days remaining', |
|
| 1167 | + $output .= ' (' . bts('@count days remaining', |
|
| 1168 | 1168 | array('@count' => $days_to_deadline), |
| 1169 | 1169 | NULL, 'boinc:team-request-foundership') . ')'; |
| 1170 | 1170 | } |
| 1171 | 1171 | $output .= '</p>'; |
| 1172 | - } |
|
| 1173 | - else { |
|
| 1172 | + } |
|
| 1173 | + else { |
|
| 1174 | 1174 | $output .= '<p>' . bts('If the team founder is not active and you want to' |
| 1175 | - . ' assume the role of founder, click below to request foundership of' |
|
| 1176 | - . ' @this_team.', |
|
| 1177 | - array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership') . '</p>'; |
|
| 1175 | + . ' assume the role of founder, click below to request foundership of' |
|
| 1176 | + . ' @this_team.', |
|
| 1177 | + array('@this_team' =>$team->title), NULL, 'boinc:team-request-foundership') . '</p>'; |
|
| 1178 | 1178 | $output .= '<ul class="tab-list">'; |
| 1179 | 1179 | $output .= ' <li class="first last tab">' . |
| 1180 | - l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
| 1180 | + l(bts('Initiate request', array(), NULL, 'boinc:team-request-foundership'), "community/teams/{$team_id}/request-foundership") . '</li>'; |
|
| 1181 | 1181 | $output .= '</ul>'; |
| 1182 | - } |
|
| 1183 | - return $output; |
|
| 1182 | + } |
|
| 1183 | + return $output; |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /** |
| 1187 | 1187 | * Respond to foundership transfer requests for a team |
| 1188 | 1188 | */ |
| 1189 | 1189 | function boincteam_request_foundership_response_panel($team_id) { |
| 1190 | - global $user; |
|
| 1191 | - $account = user_load($user->uid); |
|
| 1192 | - $team = node_load($team_id); |
|
| 1193 | - $boincteam_id = boincteam_lookup_id($team_id); |
|
| 1194 | - $boincteam = boincteam_load($boincteam_id); |
|
| 1195 | - $boincuser_id = $account->boincuser_id; |
|
| 1196 | - $output = ''; |
|
| 1190 | + global $user; |
|
| 1191 | + $account = user_load($user->uid); |
|
| 1192 | + $team = node_load($team_id); |
|
| 1193 | + $boincteam_id = boincteam_lookup_id($team_id); |
|
| 1194 | + $boincteam = boincteam_load($boincteam_id); |
|
| 1195 | + $boincuser_id = $account->boincuser_id; |
|
| 1196 | + $output = ''; |
|
| 1197 | 1197 | |
| 1198 | - if ($boincteam->ping_user) { |
|
| 1198 | + if ($boincteam->ping_user) { |
|
| 1199 | 1199 | if ($boincteam->ping_user < 0) { |
| 1200 | - $member = user_load(boincuser_lookup_uid(-$boincteam->ping_user)); |
|
| 1201 | - $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
| 1200 | + $member = user_load(boincuser_lookup_uid(-$boincteam->ping_user)); |
|
| 1201 | + $output .= '<h2 class="pane-title">' . bts('Obsolete transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
| 1202 | 1202 | . '</h2>'; |
| 1203 | - $output .= '<p>' . bts('Team member @name requested team foundership on' |
|
| 1203 | + $output .= '<p>' . bts('Team member @name requested team foundership on' |
|
| 1204 | 1204 | . ' @date, but then left the team. This request is now canceled.', |
| 1205 | 1205 | array( |
| 1206 | - '@name' => $member->boincuser_name, |
|
| 1207 | - '@date' => date('j M Y', $boincteam->ping_time), |
|
| 1206 | + '@name' => $member->boincuser_name, |
|
| 1207 | + '@date' => date('j M Y', $boincteam->ping_time), |
|
| 1208 | 1208 | ), |
| 1209 | 1209 | NULL, 'boinc:team-request-foundership-response') . '</p>'; |
| 1210 | - // Automatically cancel the request |
|
| 1211 | - db_set_active('boinc_rw'); |
|
| 1212 | - db_query(" |
|
| 1210 | + // Automatically cancel the request |
|
| 1211 | + db_set_active('boinc_rw'); |
|
| 1212 | + db_query(" |
|
| 1213 | 1213 | UPDATE {team} |
| 1214 | 1214 | SET ping_user=0 |
| 1215 | 1215 | WHERE id = '%d'", |
| 1216 | 1216 | $boincteam_id |
| 1217 | - ); |
|
| 1218 | - db_set_active('default'); |
|
| 1217 | + ); |
|
| 1218 | + db_set_active('default'); |
|
| 1219 | 1219 | } |
| 1220 | 1220 | else { |
| 1221 | - $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
|
| 1222 | - $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
| 1221 | + $member = user_load(boincuser_lookup_uid($boincteam->ping_user)); |
|
| 1222 | + $output .= '<h2 class="pane-title">' . bts('Respond to transfer request', array(), NULL, 'boinc:team-request-foundership-response') |
|
| 1223 | 1223 | . '</h2>'; |
| 1224 | - $output .= '<p>' . bts('Team member @name has requested team foundership.' |
|
| 1224 | + $output .= '<p>' . bts('Team member @name has requested team foundership.' |
|
| 1225 | 1225 | . ' This may be because you left the team or have not had contact with' |
| 1226 | 1226 | . ' the team for a long time.', array( |
| 1227 | - '@name' => $member->boincuser_name, |
|
| 1227 | + '@name' => $member->boincuser_name, |
|
| 1228 | 1228 | ) |
| 1229 | - , array(), NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
| 1230 | - $output .= '<p>' . bts("If you don't decline the request by @date, @name" |
|
| 1229 | + , array(), NULL, 'boinc:team-request-foundership-response') . '</p>'; |
|
| 1230 | + $output .= '<p>' . bts("If you don't decline the request by @date, @name" |
|
| 1231 | 1231 | . ' will have the option of assuming team foundership. (note: To' |
| 1232 | 1232 | . ' accept the request, assign foundership to @name using the form' |
| 1233 | 1233 | . ' below)', |
| 1234 | 1234 | array( |
| 1235 | - '@name' => $member->boincuser_name, |
|
| 1236 | - '@date' => date('j M Y', boincteam_foundership_transfer_ok_time($boincteam)), |
|
| 1235 | + '@name' => $member->boincuser_name, |
|
| 1236 | + '@date' => date('j M Y', boincteam_foundership_transfer_ok_time($boincteam)), |
|
| 1237 | 1237 | ), |
| 1238 | 1238 | NULL, 'boinc:team-request-foundership-response') . '</p>'; |
| 1239 | - $output .= '<ul class="tab-list">'; |
|
| 1240 | - $output .= ' <li class="first last tab">' . |
|
| 1239 | + $output .= '<ul class="tab-list">'; |
|
| 1240 | + $output .= ' <li class="first last tab">' . |
|
| 1241 | 1241 | l(bts('Deny request', array(), NULL, 'boinc:team-request-foundership-response'), "community/teams/{$team_id}/deny-foundership-request") . '</li>'; |
| 1242 | - $output .= '</ul>'; |
|
| 1242 | + $output .= '</ul>'; |
|
| 1243 | 1243 | } |
| 1244 | - } |
|
| 1245 | - return $output; |
|
| 1244 | + } |
|
| 1245 | + return $output; |
|
| 1246 | 1246 | } |
| 1247 | 1247 | |
| 1248 | 1248 | function boincteam_search_panel() { |
| 1249 | - $output = ''; |
|
| 1250 | - if (module_exists('global_search_teams_solr')) { |
|
| 1249 | + $output = ''; |
|
| 1250 | + if (module_exists('global_search_teams_solr')) { |
|
| 1251 | 1251 | $output .= '<h2 class="pane-title">' . bts('Search teams', array(), NULL, 'boinc:search-team') . '</h2>'; |
| 1252 | 1252 | //$output .= '<p>' . bts('Render a search form here.', array(), NULL, 'boinc:search-team') . '</p>'; |
| 1253 | 1253 | $output .= '<p>' . boincteam_search_view() . '</p>'; |
| 1254 | - } |
|
| 1255 | - return $output; |
|
| 1254 | + } |
|
| 1255 | + return $output; |
|
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | function boincteam_search_view($type = 'team') { |
| 1259 | - // Get the team search form |
|
| 1260 | - $search_page = apachesolr_search_page_load('team_search'); |
|
| 1261 | - module_load_include('inc', 'apachesolr_search', 'apachesolr_search.pages'); |
|
| 1262 | - return drupal_get_form('apachesolr_search_custom_page_search_form', $search_page); |
|
| 1259 | + // Get the team search form |
|
| 1260 | + $search_page = apachesolr_search_page_load('team_search'); |
|
| 1261 | + module_load_include('inc', 'apachesolr_search', 'apachesolr_search.pages'); |
|
| 1262 | + return drupal_get_form('apachesolr_search_custom_page_search_form', $search_page); |
|
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | /** |
| 1266 | 1266 | * General info about the concept of teams |
| 1267 | 1267 | */ |
| 1268 | 1268 | function boincteam_topic_overview_panel() { |
| 1269 | - $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 1270 | - $output = ''; |
|
| 1271 | - $output .= '<h2 class="pane-title">' . bts('Teams', array(), NULL, 'boinc:team-general-info') . '</h2>'; |
|
| 1272 | - $output .= '<div class="">'; |
|
| 1273 | - $output .= '<p>' . bts('@project participants may form teams. You may belong' |
|
| 1269 | + $site_name = variable_get('site_name', 'Drupal-BOINC'); |
|
| 1270 | + $output = ''; |
|
| 1271 | + $output .= '<h2 class="pane-title">' . bts('Teams', array(), NULL, 'boinc:team-general-info') . '</h2>'; |
|
| 1272 | + $output .= '<div class="">'; |
|
| 1273 | + $output .= '<p>' . bts('@project participants may form teams. You may belong' |
|
| 1274 | 1274 | . ' to only one team. You can join or quit a team at any time. To join a' |
| 1275 | 1275 | . ' team, visit its team page and click "Join this team". Each team has a' |
| 1276 | 1276 | . ' founder who may:', array('@project' => $site_name), NULL, 'boinc:team-general-info') . '</p>'; |
| 1277 | - $output .= '<ul>'; |
|
| 1278 | - $output .= ' <li>' . bts('Private Message all team members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
| 1279 | - $output .= ' <li>' . bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
| 1280 | - $output .= ' <li>' . bts('add or remove team admins', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
| 1281 | - $output .= ' <li>' . bts('remove members from the team', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
| 1282 | - $output .= ' <li>' . bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
| 1283 | - $output .= '</ul>'; |
|
| 1284 | - $output .= '</div>'; |
|
| 1285 | - return $output; |
|
| 1277 | + $output .= '<ul>'; |
|
| 1278 | + $output .= ' <li>' . bts('Private Message all team members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
| 1279 | + $output .= ' <li>' . bts("edit the team's name and description", array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
| 1280 | + $output .= ' <li>' . bts('add or remove team admins', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
| 1281 | + $output .= ' <li>' . bts('remove members from the team', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
| 1282 | + $output .= ' <li>' . bts('disband a team if it has no members', array(), NULL, 'boinc:team-general-info') . '</li>'; |
|
| 1283 | + $output .= '</ul>'; |
|
| 1284 | + $output .= '</div>'; |
|
| 1285 | + return $output; |
|
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | /** |
@@ -1310,50 +1310,50 @@ discard block |
||
| 1310 | 1310 | * Link to view a team |
| 1311 | 1311 | */ |
| 1312 | 1312 | function boincteam_view_team_panel($team_id) { |
| 1313 | - $team = node_load($team_id); |
|
| 1314 | - if ($team->type != "team") { |
|
| 1313 | + $team = node_load($team_id); |
|
| 1314 | + if ($team->type != "team") { |
|
| 1315 | 1315 | return; |
| 1316 | - } |
|
| 1317 | - $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
| 1318 | - $founder = user_load(get_drupal_id($boincteam->userid)); |
|
| 1319 | - $new_members = array(); |
|
| 1320 | - if ($boincteam->new_members) { |
|
| 1316 | + } |
|
| 1317 | + $boincteam = boincteam_load(boincteam_lookup_id($team_id), TRUE); |
|
| 1318 | + $founder = user_load(get_drupal_id($boincteam->userid)); |
|
| 1319 | + $new_members = array(); |
|
| 1320 | + if ($boincteam->new_members) { |
|
| 1321 | 1321 | foreach ($boincteam->new_members as $member) { |
| 1322 | - $account = user_load(get_drupal_id($member->id)); |
|
| 1323 | - $new_members[] = l($account->boincuser_name, "account/{$account->uid}"); |
|
| 1322 | + $account = user_load(get_drupal_id($member->id)); |
|
| 1323 | + $new_members[] = l($account->boincuser_name, "account/{$account->uid}"); |
|
| 1324 | 1324 | } |
| 1325 | - } |
|
| 1326 | - $output = ''; |
|
| 1327 | - $output .= '<h2 class="pane-title">' . $boincteam->name . '</h2>'; |
|
| 1328 | - $output .= '<div>'; |
|
| 1329 | - $output .= '<div class="left-column">'; |
|
| 1330 | - $output .= '<ul class="stats">'; |
|
| 1331 | - $output .= ' <li>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
| 1332 | - $output .= ' <li>' . bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
| 1333 | - $output .= ' <li>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
| 1334 | - $output .= ' <li>' . bts('Type', array(), NULL, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
| 1335 | - $output .= '</ul>'; |
|
| 1336 | - $output .= '</div>'; |
|
| 1337 | - $output .= '<div class="right-column">'; |
|
| 1338 | - $output .= '<ul class="stats">'; |
|
| 1339 | - $output .= ' <li>' . bts('Founder', array(), NULL, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
| 1340 | - $output .= ' <li>' . bts('New members in last day', array(), NULL, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
| 1341 | - $output .= ' <li>' . bts('Total members', array(), NULL, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
| 1342 | - $output .= ' <li>' . bts('Active members', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
| 1343 | - $output .= ' <li>' . bts('Members with credit', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
| 1344 | - $output .= '</ul>'; |
|
| 1345 | - $output .= '</div>'; |
|
| 1346 | - $output .= '</div>'; |
|
| 1347 | - $output .= '<div class="clearfix"></div>'; |
|
| 1348 | - if ($boincteam->url) { |
|
| 1325 | + } |
|
| 1326 | + $output = ''; |
|
| 1327 | + $output .= '<h2 class="pane-title">' . $boincteam->name . '</h2>'; |
|
| 1328 | + $output .= '<div>'; |
|
| 1329 | + $output .= '<div class="left-column">'; |
|
| 1330 | + $output .= '<ul class="stats">'; |
|
| 1331 | + $output .= ' <li>' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . ': ' . number_format($boincteam->total_credit, 0) . '</li>'; |
|
| 1332 | + $output .= ' <li>' . bts('Recent average credit', array(), NULL, 'boinc:user-or-team-RAC') . ': ' . number_format($boincteam->expavg_credit, 2) . '</li>'; |
|
| 1333 | + $output .= ' <li>' . bts('Country', array(), NULL, 'boinc:country-of-origin') . ': ' . $boincteam->country . '</li>'; |
|
| 1334 | + $output .= ' <li>' . bts('Type', array(), NULL, 'boinc:view-team-info') . ': ' . boincteam_get_type($team_id) . '</li>'; |
|
| 1335 | + $output .= '</ul>'; |
|
| 1336 | + $output .= '</div>'; |
|
| 1337 | + $output .= '<div class="right-column">'; |
|
| 1338 | + $output .= '<ul class="stats">'; |
|
| 1339 | + $output .= ' <li>' . bts('Founder', array(), NULL, 'boinc:view-team-info') . ': ' . l($founder->boincuser_name, "account/{$founder->uid}") . '</li>'; |
|
| 1340 | + $output .= ' <li>' . bts('New members in last day', array(), NULL, 'boinc:view-team-info') . ': ' . implode('·', $new_members) . '</li>'; |
|
| 1341 | + $output .= ' <li>' . bts('Total members', array(), NULL, 'boinc:view-team-info') . ': ' . l($boincteam->nusers, "community/teams/{$team_id}/members") . '</li>'; |
|
| 1342 | + $output .= ' <li>' . bts('Active members', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_active . '</li>'; |
|
| 1343 | + $output .= ' <li>' . bts('Members with credit', array(), NULL, 'boinc:view-team-info') . ': ' . $boincteam->nusers_worked . '</li>'; |
|
| 1344 | + $output .= '</ul>'; |
|
| 1345 | + $output .= '</div>'; |
|
| 1346 | + $output .= '</div>'; |
|
| 1347 | + $output .= '<div class="clearfix"></div>'; |
|
| 1348 | + if ($boincteam->url) { |
|
| 1349 | 1349 | $output .= '<div class="stats">'; |
| 1350 | 1350 | $output .= bts('Website', array(), NULL, 'boinc:website-of-user-or-team') . ': ' . l("http://{$boincteam->url}", "http://{$boincteam->url}"); |
| 1351 | 1351 | $output .= '</div>'; |
| 1352 | - } |
|
| 1353 | - if ($team->body) { |
|
| 1352 | + } |
|
| 1353 | + if ($team->body) { |
|
| 1354 | 1354 | $output .= '<h3>' . bts('Description', array(), NULL, 'boinc:team-description') . '</h3>'; |
| 1355 | 1355 | $output .= check_markup($team->body, $team->format); |
| 1356 | 1356 | $output .= '</div>'; |
| 1357 | - } |
|
| 1358 | - return $output; |
|
| 1357 | + } |
|
| 1358 | + return $output; |
|
| 1359 | 1359 | } |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | if ($disable_account_creation || defined('INVITE_CODES')) { |
| 84 | - echo " <account_creation_disabled/>\n"; |
|
| 84 | + echo " <account_creation_disabled/>\n"; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if (defined('INVITE_CODES')) { |
| 88 | - echo " <invite_code_required/>\n"; |
|
| 88 | + echo " <invite_code_required/>\n"; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | echo " <min_passwd_length>$min_passwd_length</min_passwd_length>\n"; |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | // project has not defined the constant TERMSOFUSE_FILE, then look for |
| 108 | 108 | // the terms_of_use.txt file in the project base directory. |
| 109 | 109 | if (defined('TERMSOFUSE_FILE')) { |
| 110 | - $tou_file = TERMSOFUSE_FILE; |
|
| 110 | + $tou_file = TERMSOFUSE_FILE; |
|
| 111 | 111 | } |
| 112 | 112 | else { |
| 113 | - $tou_file = "../../terms_of_use.txt"; |
|
| 113 | + $tou_file = "../../terms_of_use.txt"; |
|
| 114 | 114 | } |
| 115 | 115 | if (file_exists($tou_file)) { |
| 116 | 116 | $terms_of_use = trim(file_get_contents($tou_file)); |
@@ -4,110 +4,110 @@ |
||
| 4 | 4 | * Implementation of hook_user_default_permissions(). |
| 5 | 5 | */ |
| 6 | 6 | function discussion_forums_user_default_permissions() { |
| 7 | - $permissions = array(); |
|
| 7 | + $permissions = array(); |
|
| 8 | 8 | |
| 9 | - // Exported permission: access comments |
|
| 10 | - $permissions['access comments'] = array( |
|
| 9 | + // Exported permission: access comments |
|
| 10 | + $permissions['access comments'] = array( |
|
| 11 | 11 | 'name' => 'access comments', |
| 12 | 12 | 'roles' => array( |
| 13 | - '0' => 'administrator', |
|
| 14 | - '1' => 'anonymous user', |
|
| 15 | - '2' => 'authenticated user', |
|
| 13 | + '0' => 'administrator', |
|
| 14 | + '1' => 'anonymous user', |
|
| 15 | + '2' => 'authenticated user', |
|
| 16 | 16 | ), |
| 17 | - ); |
|
| 17 | + ); |
|
| 18 | 18 | |
| 19 | - // Exported permission: administer comments |
|
| 20 | - $permissions['administer comments'] = array( |
|
| 19 | + // Exported permission: administer comments |
|
| 20 | + $permissions['administer comments'] = array( |
|
| 21 | 21 | 'name' => 'administer comments', |
| 22 | 22 | 'roles' => array( |
| 23 | - '0' => 'administrator', |
|
| 24 | - '1' => 'moderator', |
|
| 23 | + '0' => 'administrator', |
|
| 24 | + '1' => 'moderator', |
|
| 25 | 25 | ), |
| 26 | - ); |
|
| 26 | + ); |
|
| 27 | 27 | |
| 28 | - // Exported permission: administer forums |
|
| 29 | - $permissions['administer forums'] = array( |
|
| 28 | + // Exported permission: administer forums |
|
| 29 | + $permissions['administer forums'] = array( |
|
| 30 | 30 | 'name' => 'administer forums', |
| 31 | 31 | 'roles' => array( |
| 32 | - '0' => 'administrator', |
|
| 32 | + '0' => 'administrator', |
|
| 33 | 33 | ), |
| 34 | - ); |
|
| 34 | + ); |
|
| 35 | 35 | |
| 36 | - // Exported permission: assign community member role |
|
| 37 | - $permissions['assign community member role'] = array( |
|
| 36 | + // Exported permission: assign community member role |
|
| 37 | + $permissions['assign community member role'] = array( |
|
| 38 | 38 | 'name' => 'assign community member role', |
| 39 | 39 | 'roles' => array( |
| 40 | - '0' => 'moderator', |
|
| 40 | + '0' => 'moderator', |
|
| 41 | 41 | ), |
| 42 | - ); |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | - // Exported permission: create forum topics |
|
| 45 | - $permissions['create forum topics'] = array( |
|
| 44 | + // Exported permission: create forum topics |
|
| 45 | + $permissions['create forum topics'] = array( |
|
| 46 | 46 | 'name' => 'create forum topics', |
| 47 | 47 | 'roles' => array( |
| 48 | - '0' => 'administrator', |
|
| 49 | - '1' => 'community member', |
|
| 50 | - '2' => 'moderator', |
|
| 51 | - '3' => 'verified contributor', |
|
| 48 | + '0' => 'administrator', |
|
| 49 | + '1' => 'community member', |
|
| 50 | + '2' => 'moderator', |
|
| 51 | + '3' => 'verified contributor', |
|
| 52 | 52 | ), |
| 53 | - ); |
|
| 53 | + ); |
|
| 54 | 54 | |
| 55 | - // Exported permission: delete any forum topic |
|
| 56 | - $permissions['delete any forum topic'] = array( |
|
| 55 | + // Exported permission: delete any forum topic |
|
| 56 | + $permissions['delete any forum topic'] = array( |
|
| 57 | 57 | 'name' => 'delete any forum topic', |
| 58 | 58 | 'roles' => array( |
| 59 | - '0' => 'administrator', |
|
| 59 | + '0' => 'administrator', |
|
| 60 | 60 | ), |
| 61 | - ); |
|
| 61 | + ); |
|
| 62 | 62 | |
| 63 | - // Exported permission: delete own forum topics |
|
| 64 | - $permissions['delete own forum topics'] = array( |
|
| 63 | + // Exported permission: delete own forum topics |
|
| 64 | + $permissions['delete own forum topics'] = array( |
|
| 65 | 65 | 'name' => 'delete own forum topics', |
| 66 | 66 | 'roles' => array( |
| 67 | - '0' => 'administrator', |
|
| 67 | + '0' => 'administrator', |
|
| 68 | 68 | ), |
| 69 | - ); |
|
| 69 | + ); |
|
| 70 | 70 | |
| 71 | - // Exported permission: edit any forum topic |
|
| 72 | - $permissions['edit any forum topic'] = array( |
|
| 71 | + // Exported permission: edit any forum topic |
|
| 72 | + $permissions['edit any forum topic'] = array( |
|
| 73 | 73 | 'name' => 'edit any forum topic', |
| 74 | 74 | 'roles' => array( |
| 75 | - '0' => 'administrator', |
|
| 76 | - '1' => 'moderator', |
|
| 75 | + '0' => 'administrator', |
|
| 76 | + '1' => 'moderator', |
|
| 77 | 77 | ), |
| 78 | - ); |
|
| 78 | + ); |
|
| 79 | 79 | |
| 80 | - // Exported permission: edit own forum topics |
|
| 81 | - $permissions['edit own forum topics'] = array( |
|
| 80 | + // Exported permission: edit own forum topics |
|
| 81 | + $permissions['edit own forum topics'] = array( |
|
| 82 | 82 | 'name' => 'edit own forum topics', |
| 83 | 83 | 'roles' => array( |
| 84 | - '0' => 'administrator', |
|
| 85 | - '1' => 'community member', |
|
| 86 | - '2' => 'verified contributor', |
|
| 84 | + '0' => 'administrator', |
|
| 85 | + '1' => 'community member', |
|
| 86 | + '2' => 'verified contributor', |
|
| 87 | 87 | ), |
| 88 | - ); |
|
| 88 | + ); |
|
| 89 | 89 | |
| 90 | - // Exported permission: post comments |
|
| 91 | - $permissions['post comments'] = array( |
|
| 90 | + // Exported permission: post comments |
|
| 91 | + $permissions['post comments'] = array( |
|
| 92 | 92 | 'name' => 'post comments', |
| 93 | 93 | 'roles' => array( |
| 94 | - '0' => 'administrator', |
|
| 95 | - '1' => 'community member', |
|
| 96 | - '2' => 'moderator', |
|
| 97 | - '3' => 'verified contributor', |
|
| 94 | + '0' => 'administrator', |
|
| 95 | + '1' => 'community member', |
|
| 96 | + '2' => 'moderator', |
|
| 97 | + '3' => 'verified contributor', |
|
| 98 | 98 | ), |
| 99 | - ); |
|
| 99 | + ); |
|
| 100 | 100 | |
| 101 | - // Exported permission: post comments without approval |
|
| 102 | - $permissions['post comments without approval'] = array( |
|
| 101 | + // Exported permission: post comments without approval |
|
| 102 | + $permissions['post comments without approval'] = array( |
|
| 103 | 103 | 'name' => 'post comments without approval', |
| 104 | 104 | 'roles' => array( |
| 105 | - '0' => 'administrator', |
|
| 106 | - '1' => 'community member', |
|
| 107 | - '2' => 'moderator', |
|
| 108 | - '3' => 'verified contributor', |
|
| 105 | + '0' => 'administrator', |
|
| 106 | + '1' => 'community member', |
|
| 107 | + '2' => 'moderator', |
|
| 108 | + '3' => 'verified contributor', |
|
| 109 | 109 | ), |
| 110 | - ); |
|
| 110 | + ); |
|
| 111 | 111 | |
| 112 | - return $permissions; |
|
| 112 | + return $permissions; |
|
| 113 | 113 | } |
@@ -4,113 +4,113 @@ discard block |
||
| 4 | 4 | * Implementation of hook_default_page_manager_pages(). |
| 5 | 5 | */ |
| 6 | 6 | function boinc_standard_default_page_manager_pages() { |
| 7 | - $page = new stdClass; |
|
| 8 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 9 | - $page->api_version = 1; |
|
| 10 | - $page->name = 'about_us'; |
|
| 11 | - $page->task = 'page'; |
|
| 12 | - $page->admin_title = 'About Us'; |
|
| 13 | - $page->admin_description = ''; |
|
| 14 | - $page->path = 'about.fail'; |
|
| 15 | - $page->access = array( |
|
| 7 | + $page = new stdClass; |
|
| 8 | + $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 9 | + $page->api_version = 1; |
|
| 10 | + $page->name = 'about_us'; |
|
| 11 | + $page->task = 'page'; |
|
| 12 | + $page->admin_title = 'About Us'; |
|
| 13 | + $page->admin_description = ''; |
|
| 14 | + $page->path = 'about.fail'; |
|
| 15 | + $page->access = array( |
|
| 16 | 16 | 'type' => 'none', |
| 17 | 17 | 'settings' => NULL, |
| 18 | - ); |
|
| 19 | - $page->menu = array(); |
|
| 20 | - $page->arguments = array(); |
|
| 21 | - $page->conf = array(); |
|
| 22 | - $page->default_handlers = array(); |
|
| 23 | - $pages['about_us'] = $page; |
|
| 18 | + ); |
|
| 19 | + $page->menu = array(); |
|
| 20 | + $page->arguments = array(); |
|
| 21 | + $page->conf = array(); |
|
| 22 | + $page->default_handlers = array(); |
|
| 23 | + $pages['about_us'] = $page; |
|
| 24 | 24 | |
| 25 | - $page = new stdClass; |
|
| 26 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 27 | - $page->api_version = 1; |
|
| 28 | - $page->name = 'account_dashboard'; |
|
| 29 | - $page->task = 'page'; |
|
| 30 | - $page->admin_title = 'Dashboard'; |
|
| 31 | - $page->admin_description = ''; |
|
| 32 | - $page->path = 'dashboard'; |
|
| 33 | - $page->access = array( |
|
| 25 | + $page = new stdClass; |
|
| 26 | + $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 27 | + $page->api_version = 1; |
|
| 28 | + $page->name = 'account_dashboard'; |
|
| 29 | + $page->task = 'page'; |
|
| 30 | + $page->admin_title = 'Dashboard'; |
|
| 31 | + $page->admin_description = ''; |
|
| 32 | + $page->path = 'dashboard'; |
|
| 33 | + $page->access = array( |
|
| 34 | 34 | 'plugins' => array( |
| 35 | - 1 => array( |
|
| 35 | + 1 => array( |
|
| 36 | 36 | 'name' => 'role', |
| 37 | 37 | 'settings' => array( |
| 38 | - 'rids' => array( |
|
| 38 | + 'rids' => array( |
|
| 39 | 39 | 0 => 2, |
| 40 | - ), |
|
| 40 | + ), |
|
| 41 | 41 | ), |
| 42 | 42 | 'context' => 'logged-in-user', |
| 43 | 43 | 'not' => FALSE, |
| 44 | - ), |
|
| 44 | + ), |
|
| 45 | 45 | ), |
| 46 | 46 | 'logic' => 'and', |
| 47 | 47 | 'type' => 'none', |
| 48 | 48 | 'settings' => NULL, |
| 49 | - ); |
|
| 50 | - $page->menu = array( |
|
| 49 | + ); |
|
| 50 | + $page->menu = array( |
|
| 51 | 51 | 'type' => 'none', |
| 52 | 52 | 'title' => 'Dashboard', |
| 53 | 53 | 'name' => 'navigation', |
| 54 | 54 | 'weight' => '0', |
| 55 | 55 | 'parent' => array( |
| 56 | - 'type' => 'normal', |
|
| 57 | - 'title' => 'Account', |
|
| 58 | - 'name' => 'navigation', |
|
| 59 | - 'weight' => '0', |
|
| 56 | + 'type' => 'normal', |
|
| 57 | + 'title' => 'Account', |
|
| 58 | + 'name' => 'navigation', |
|
| 59 | + 'weight' => '0', |
|
| 60 | 60 | ), |
| 61 | - ); |
|
| 62 | - $page->arguments = array(); |
|
| 63 | - $page->conf = array(); |
|
| 64 | - $page->default_handlers = array(); |
|
| 65 | - $handler = new stdClass; |
|
| 66 | - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
| 67 | - $handler->api_version = 1; |
|
| 68 | - $handler->name = 'page_account_dashboard_panel_context'; |
|
| 69 | - $handler->task = 'page'; |
|
| 70 | - $handler->subtask = 'account_dashboard'; |
|
| 71 | - $handler->handler = 'panel_context'; |
|
| 72 | - $handler->weight = 0; |
|
| 73 | - $handler->conf = array( |
|
| 61 | + ); |
|
| 62 | + $page->arguments = array(); |
|
| 63 | + $page->conf = array(); |
|
| 64 | + $page->default_handlers = array(); |
|
| 65 | + $handler = new stdClass; |
|
| 66 | + $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
| 67 | + $handler->api_version = 1; |
|
| 68 | + $handler->name = 'page_account_dashboard_panel_context'; |
|
| 69 | + $handler->task = 'page'; |
|
| 70 | + $handler->subtask = 'account_dashboard'; |
|
| 71 | + $handler->handler = 'panel_context'; |
|
| 72 | + $handler->weight = 0; |
|
| 73 | + $handler->conf = array( |
|
| 74 | 74 | 'title' => 'Landing page', |
| 75 | 75 | 'no_blocks' => FALSE, |
| 76 | 76 | 'pipeline' => 'ipe', |
| 77 | 77 | 'css_id' => '', |
| 78 | 78 | 'css' => '', |
| 79 | 79 | 'contexts' => array( |
| 80 | - 0 => array( |
|
| 80 | + 0 => array( |
|
| 81 | 81 | 'name' => 'user', |
| 82 | 82 | 'id' => 1, |
| 83 | 83 | 'identifier' => 'User', |
| 84 | 84 | 'keyword' => 'user', |
| 85 | 85 | 'context_settings' => array( |
| 86 | - 'type' => 'current', |
|
| 87 | - 'user' => '', |
|
| 88 | - 'uid' => '', |
|
| 86 | + 'type' => 'current', |
|
| 87 | + 'user' => '', |
|
| 88 | + 'uid' => '', |
|
| 89 | + ), |
|
| 89 | 90 | ), |
| 90 | - ), |
|
| 91 | 91 | ), |
| 92 | 92 | 'relationships' => array(), |
| 93 | 93 | 'access' => array( |
| 94 | - 'plugins' => array(), |
|
| 95 | - 'logic' => 'and', |
|
| 94 | + 'plugins' => array(), |
|
| 95 | + 'logic' => 'and', |
|
| 96 | 96 | ), |
| 97 | - ); |
|
| 98 | - $display = new panels_display; |
|
| 99 | - $display->layout = 'one_sidebar_second'; |
|
| 100 | - $display->layout_settings = array(); |
|
| 101 | - $display->panel_settings = array( |
|
| 97 | + ); |
|
| 98 | + $display = new panels_display; |
|
| 99 | + $display->layout = 'one_sidebar_second'; |
|
| 100 | + $display->layout_settings = array(); |
|
| 101 | + $display->panel_settings = array( |
|
| 102 | 102 | 'style_settings' => array( |
| 103 | - 'default' => NULL, |
|
| 104 | - 'content' => NULL, |
|
| 105 | - 'sidebar_first' => NULL, |
|
| 103 | + 'default' => NULL, |
|
| 104 | + 'content' => NULL, |
|
| 105 | + 'sidebar_first' => NULL, |
|
| 106 | 106 | ), |
| 107 | - ); |
|
| 108 | - $display->cache = array(); |
|
| 109 | - $display->title = 'Dashboard'; |
|
| 110 | - $display->storage_type = 'page_manager'; |
|
| 111 | - $display->storage_id = 'page_account_dashboard_panel_context'; |
|
| 112 | - $display->content = array(); |
|
| 113 | - $display->panels = array(); |
|
| 107 | + ); |
|
| 108 | + $display->cache = array(); |
|
| 109 | + $display->title = 'Dashboard'; |
|
| 110 | + $display->storage_type = 'page_manager'; |
|
| 111 | + $display->storage_id = 'page_account_dashboard_panel_context'; |
|
| 112 | + $display->content = array(); |
|
| 113 | + $display->panels = array(); |
|
| 114 | 114 | $pane = new stdClass; |
| 115 | 115 | $pane->pid = 'new-1'; |
| 116 | 116 | $pane->panel = 'content'; |
@@ -119,16 +119,16 @@ discard block |
||
| 119 | 119 | $pane->shown = TRUE; |
| 120 | 120 | $pane->access = array(); |
| 121 | 121 | $pane->configuration = array( |
| 122 | - 'override_title' => 1, |
|
| 123 | - 'override_title_text' => 'My stats', |
|
| 122 | + 'override_title' => 1, |
|
| 123 | + 'override_title_text' => 'My stats', |
|
| 124 | 124 | ); |
| 125 | 125 | $pane->cache = array(); |
| 126 | 126 | $pane->style = array( |
| 127 | - 'settings' => NULL, |
|
| 127 | + 'settings' => NULL, |
|
| 128 | 128 | ); |
| 129 | 129 | $pane->css = array( |
| 130 | - 'css_id' => '', |
|
| 131 | - 'css_class' => 'panel-primary container shadow', |
|
| 130 | + 'css_id' => '', |
|
| 131 | + 'css_class' => 'panel-primary container shadow', |
|
| 132 | 132 | ); |
| 133 | 133 | $pane->extras = array(); |
| 134 | 134 | $pane->position = 0; |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | $pane->configuration = array(); |
| 145 | 145 | $pane->cache = array(); |
| 146 | 146 | $pane->style = array( |
| 147 | - 'settings' => NULL, |
|
| 147 | + 'settings' => NULL, |
|
| 148 | 148 | ); |
| 149 | 149 | $pane->css = array( |
| 150 | - 'css_id' => '', |
|
| 151 | - 'css_class' => 'panel-primary container shadow', |
|
| 150 | + 'css_id' => '', |
|
| 151 | + 'css_class' => 'panel-primary container shadow', |
|
| 152 | 152 | ); |
| 153 | 153 | $pane->extras = array(); |
| 154 | 154 | $pane->position = 1; |
@@ -161,31 +161,31 @@ discard block |
||
| 161 | 161 | $pane->subtype = 'custom'; |
| 162 | 162 | $pane->shown = TRUE; |
| 163 | 163 | $pane->access = array( |
| 164 | - 'plugins' => array( |
|
| 164 | + 'plugins' => array( |
|
| 165 | 165 | 1 => array( |
| 166 | - 'name' => 'perm', |
|
| 167 | - 'settings' => array( |
|
| 166 | + 'name' => 'perm', |
|
| 167 | + 'settings' => array( |
|
| 168 | 168 | 'perm' => 'edit any profile content', |
| 169 | - ), |
|
| 170 | - 'context' => 'context_user_1', |
|
| 171 | - 'not' => FALSE, |
|
| 169 | + ), |
|
| 170 | + 'context' => 'context_user_1', |
|
| 171 | + 'not' => FALSE, |
|
| 172 | + ), |
|
| 172 | 173 | ), |
| 173 | - ), |
|
| 174 | 174 | ); |
| 175 | 175 | $pane->configuration = array( |
| 176 | - 'admin_title' => 'Moderation overview', |
|
| 177 | - 'title' => '', |
|
| 178 | - 'body' => '<?php print boinccore_moderation_overview_panel(); ?>', |
|
| 179 | - 'format' => '3', |
|
| 180 | - 'substitute' => 1, |
|
| 176 | + 'admin_title' => 'Moderation overview', |
|
| 177 | + 'title' => '', |
|
| 178 | + 'body' => '<?php print boinccore_moderation_overview_panel(); ?>', |
|
| 179 | + 'format' => '3', |
|
| 180 | + 'substitute' => 1, |
|
| 181 | 181 | ); |
| 182 | 182 | $pane->cache = array(); |
| 183 | 183 | $pane->style = array( |
| 184 | - 'settings' => NULL, |
|
| 184 | + 'settings' => NULL, |
|
| 185 | 185 | ); |
| 186 | 186 | $pane->css = array( |
| 187 | - 'css_id' => '', |
|
| 188 | - 'css_class' => 'panel-secondary container shadow', |
|
| 187 | + 'css_id' => '', |
|
| 188 | + 'css_class' => 'panel-secondary container shadow', |
|
| 189 | 189 | ); |
| 190 | 190 | $pane->extras = array(); |
| 191 | 191 | $pane->position = 0; |
@@ -199,16 +199,16 @@ discard block |
||
| 199 | 199 | $pane->shown = TRUE; |
| 200 | 200 | $pane->access = array(); |
| 201 | 201 | $pane->configuration = array( |
| 202 | - 'override_title' => 0, |
|
| 203 | - 'override_title_text' => '', |
|
| 202 | + 'override_title' => 0, |
|
| 203 | + 'override_title_text' => '', |
|
| 204 | 204 | ); |
| 205 | 205 | $pane->cache = array(); |
| 206 | 206 | $pane->style = array( |
| 207 | - 'settings' => NULL, |
|
| 207 | + 'settings' => NULL, |
|
| 208 | 208 | ); |
| 209 | 209 | $pane->css = array( |
| 210 | - 'css_id' => '', |
|
| 211 | - 'css_class' => 'panel-secondary container shadow', |
|
| 210 | + 'css_id' => '', |
|
| 211 | + 'css_class' => 'panel-secondary container shadow', |
|
| 212 | 212 | ); |
| 213 | 213 | $pane->extras = array(); |
| 214 | 214 | $pane->position = 1; |
@@ -222,23 +222,23 @@ discard block |
||
| 222 | 222 | $pane->shown = TRUE; |
| 223 | 223 | $pane->access = array(); |
| 224 | 224 | $pane->configuration = array( |
| 225 | - 'admin_title' => 'Team summary', |
|
| 226 | - 'title' => '', |
|
| 227 | - 'body' => '<?php |
|
| 225 | + 'admin_title' => 'Team summary', |
|
| 226 | + 'title' => '', |
|
| 227 | + 'body' => '<?php |
|
| 228 | 228 | if (module_exists(\'boincteam\')) { |
| 229 | 229 | echo boincteam_dashboard_panel(); |
| 230 | 230 | } |
| 231 | 231 | ?>', |
| 232 | - 'format' => '3', |
|
| 233 | - 'substitute' => 1, |
|
| 232 | + 'format' => '3', |
|
| 233 | + 'substitute' => 1, |
|
| 234 | 234 | ); |
| 235 | 235 | $pane->cache = array(); |
| 236 | 236 | $pane->style = array( |
| 237 | - 'settings' => NULL, |
|
| 237 | + 'settings' => NULL, |
|
| 238 | 238 | ); |
| 239 | 239 | $pane->css = array( |
| 240 | - 'css_id' => 'team-dashboard-pane', |
|
| 241 | - 'css_class' => 'panel-secondary container shadow', |
|
| 240 | + 'css_id' => 'team-dashboard-pane', |
|
| 241 | + 'css_class' => 'panel-secondary container shadow', |
|
| 242 | 242 | ); |
| 243 | 243 | $pane->extras = array(); |
| 244 | 244 | $pane->position = 2; |
@@ -252,9 +252,9 @@ discard block |
||
| 252 | 252 | $pane->shown = TRUE; |
| 253 | 253 | $pane->access = array(); |
| 254 | 254 | $pane->configuration = array( |
| 255 | - 'admin_title' => 'User activity summary', |
|
| 256 | - 'title' => '', |
|
| 257 | - 'body' => '<?php |
|
| 255 | + 'admin_title' => 'User activity summary', |
|
| 256 | + 'title' => '', |
|
| 257 | + 'body' => '<?php |
|
| 258 | 258 | |
| 259 | 259 | global $user; |
| 260 | 260 | $uid = $user->uid; |
@@ -263,16 +263,16 @@ discard block |
||
| 263 | 263 | echo \'<div class="item-count-wrapper"><div class="item-count">\' . $account->post_count . \'</div></div>\'; |
| 264 | 264 | |
| 265 | 265 | ?>', |
| 266 | - 'format' => '3', |
|
| 267 | - 'substitute' => 1, |
|
| 266 | + 'format' => '3', |
|
| 267 | + 'substitute' => 1, |
|
| 268 | 268 | ); |
| 269 | 269 | $pane->cache = array(); |
| 270 | 270 | $pane->style = array( |
| 271 | - 'settings' => NULL, |
|
| 271 | + 'settings' => NULL, |
|
| 272 | 272 | ); |
| 273 | 273 | $pane->css = array( |
| 274 | - 'css_id' => '', |
|
| 275 | - 'css_class' => 'panel-secondary container shadow', |
|
| 274 | + 'css_id' => '', |
|
| 275 | + 'css_class' => 'panel-secondary container shadow', |
|
| 276 | 276 | ); |
| 277 | 277 | $pane->extras = array(); |
| 278 | 278 | $pane->position = 3; |
@@ -286,74 +286,74 @@ discard block |
||
| 286 | 286 | $pane->shown = TRUE; |
| 287 | 287 | $pane->access = array(); |
| 288 | 288 | $pane->configuration = array( |
| 289 | - 'override_pager_settings' => 0, |
|
| 290 | - 'use_pager' => 0, |
|
| 291 | - 'nodes_per_page' => '6', |
|
| 292 | - 'pager_id' => '', |
|
| 293 | - 'offset' => '0', |
|
| 294 | - 'more_link' => 1, |
|
| 295 | - 'feed_icons' => 0, |
|
| 296 | - 'panel_args' => 0, |
|
| 297 | - 'link_to_view' => 0, |
|
| 298 | - 'args' => '', |
|
| 299 | - 'url' => '', |
|
| 300 | - 'display' => 'block_1', |
|
| 301 | - 'context' => array( |
|
| 289 | + 'override_pager_settings' => 0, |
|
| 290 | + 'use_pager' => 0, |
|
| 291 | + 'nodes_per_page' => '6', |
|
| 292 | + 'pager_id' => '', |
|
| 293 | + 'offset' => '0', |
|
| 294 | + 'more_link' => 1, |
|
| 295 | + 'feed_icons' => 0, |
|
| 296 | + 'panel_args' => 0, |
|
| 297 | + 'link_to_view' => 0, |
|
| 298 | + 'args' => '', |
|
| 299 | + 'url' => '', |
|
| 300 | + 'display' => 'block_1', |
|
| 301 | + 'context' => array( |
|
| 302 | 302 | 0 => 'context_user_1.uid', |
| 303 | - ), |
|
| 304 | - 'override_title' => 0, |
|
| 305 | - 'override_title_text' => '', |
|
| 303 | + ), |
|
| 304 | + 'override_title' => 0, |
|
| 305 | + 'override_title_text' => '', |
|
| 306 | 306 | ); |
| 307 | 307 | $pane->cache = array(); |
| 308 | 308 | $pane->style = array( |
| 309 | - 'settings' => NULL, |
|
| 309 | + 'settings' => NULL, |
|
| 310 | 310 | ); |
| 311 | 311 | $pane->css = array( |
| 312 | - 'css_id' => '', |
|
| 313 | - 'css_class' => 'panel-secondary container shadow', |
|
| 312 | + 'css_id' => '', |
|
| 313 | + 'css_class' => 'panel-secondary container shadow', |
|
| 314 | 314 | ); |
| 315 | 315 | $pane->extras = array(); |
| 316 | 316 | $pane->position = 4; |
| 317 | 317 | $display->content['new-7'] = $pane; |
| 318 | 318 | $display->panels['sidebar_first'][4] = 'new-7'; |
| 319 | - $display->hide_title = PANELS_TITLE_FIXED; |
|
| 320 | - $display->title_pane = 'new-1'; |
|
| 321 | - $handler->conf['display'] = $display; |
|
| 322 | - $page->default_handlers[$handler->name] = $handler; |
|
| 323 | - $pages['account_dashboard'] = $page; |
|
| 319 | + $display->hide_title = PANELS_TITLE_FIXED; |
|
| 320 | + $display->title_pane = 'new-1'; |
|
| 321 | + $handler->conf['display'] = $display; |
|
| 322 | + $page->default_handlers[$handler->name] = $handler; |
|
| 323 | + $pages['account_dashboard'] = $page; |
|
| 324 | 324 | |
| 325 | - $page = new stdClass; |
|
| 326 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 327 | - $page->api_version = 1; |
|
| 328 | - $page->name = 'boinc_user'; |
|
| 329 | - $page->task = 'page'; |
|
| 330 | - $page->admin_title = 'User profile template (boinc)'; |
|
| 331 | - $page->admin_description = ''; |
|
| 332 | - $page->path = 'account/%user'; |
|
| 333 | - $page->access = array( |
|
| 325 | + $page = new stdClass; |
|
| 326 | + $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 327 | + $page->api_version = 1; |
|
| 328 | + $page->name = 'boinc_user'; |
|
| 329 | + $page->task = 'page'; |
|
| 330 | + $page->admin_title = 'User profile template (boinc)'; |
|
| 331 | + $page->admin_description = ''; |
|
| 332 | + $page->path = 'account/%user'; |
|
| 333 | + $page->access = array( |
|
| 334 | 334 | 'type' => 'none', |
| 335 | 335 | 'settings' => NULL, |
| 336 | - ); |
|
| 337 | - $page->menu = array(); |
|
| 338 | - $page->arguments = array( |
|
| 336 | + ); |
|
| 337 | + $page->menu = array(); |
|
| 338 | + $page->arguments = array( |
|
| 339 | 339 | 'user' => array( |
| 340 | - 'id' => 1, |
|
| 341 | - 'identifier' => 'User: ID', |
|
| 342 | - 'name' => 'uid', |
|
| 343 | - 'settings' => array(), |
|
| 340 | + 'id' => 1, |
|
| 341 | + 'identifier' => 'User: ID', |
|
| 342 | + 'name' => 'uid', |
|
| 343 | + 'settings' => array(), |
|
| 344 | 344 | ), |
| 345 | - ); |
|
| 346 | - $page->conf = array(); |
|
| 347 | - $page->default_handlers = array(); |
|
| 348 | - $handler = new stdClass; |
|
| 349 | - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
| 350 | - $handler->api_version = 1; |
|
| 351 | - $handler->name = 'page_boinc_user_panel_context_2'; |
|
| 352 | - $handler->task = 'page'; |
|
| 353 | - $handler->subtask = 'boinc_user'; |
|
| 354 | - $handler->handler = 'panel_context'; |
|
| 355 | - $handler->weight = 1; |
|
| 356 | - $handler->conf = array( |
|
| 345 | + ); |
|
| 346 | + $page->conf = array(); |
|
| 347 | + $page->default_handlers = array(); |
|
| 348 | + $handler = new stdClass; |
|
| 349 | + $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
| 350 | + $handler->api_version = 1; |
|
| 351 | + $handler->name = 'page_boinc_user_panel_context_2'; |
|
| 352 | + $handler->task = 'page'; |
|
| 353 | + $handler->subtask = 'boinc_user'; |
|
| 354 | + $handler->handler = 'panel_context'; |
|
| 355 | + $handler->weight = 1; |
|
| 356 | + $handler->conf = array( |
|
| 357 | 357 | 'title' => 'Panel', |
| 358 | 358 | 'no_blocks' => 0, |
| 359 | 359 | 'pipeline' => 'standard', |
@@ -362,37 +362,37 @@ discard block |
||
| 362 | 362 | 'contexts' => array(), |
| 363 | 363 | 'relationships' => array(), |
| 364 | 364 | 'access' => array( |
| 365 | - 'plugins' => array( |
|
| 365 | + 'plugins' => array( |
|
| 366 | 366 | 0 => array( |
| 367 | - 'name' => 'php', |
|
| 368 | - 'settings' => array( |
|
| 367 | + 'name' => 'php', |
|
| 368 | + 'settings' => array( |
|
| 369 | 369 | 'description' => 'if user status then show profile', |
| 370 | 370 | 'php' => '$account = $contexts[\'argument_uid_1\']->data; |
| 371 | 371 | return ($account->status); |
| 372 | 372 | ', |
| 373 | - ), |
|
| 374 | - 'not' => FALSE, |
|
| 373 | + ), |
|
| 374 | + 'not' => FALSE, |
|
| 375 | + ), |
|
| 375 | 376 | ), |
| 376 | - ), |
|
| 377 | - 'logic' => 'and', |
|
| 377 | + 'logic' => 'and', |
|
| 378 | 378 | ), |
| 379 | - ); |
|
| 380 | - $display = new panels_display; |
|
| 381 | - $display->layout = 'one_sidebar_second'; |
|
| 382 | - $display->layout_settings = array(); |
|
| 383 | - $display->panel_settings = array( |
|
| 379 | + ); |
|
| 380 | + $display = new panels_display; |
|
| 381 | + $display->layout = 'one_sidebar_second'; |
|
| 382 | + $display->layout_settings = array(); |
|
| 383 | + $display->panel_settings = array( |
|
| 384 | 384 | 'style_settings' => array( |
| 385 | - 'default' => NULL, |
|
| 386 | - 'content' => NULL, |
|
| 387 | - 'sidebar_first' => NULL, |
|
| 385 | + 'default' => NULL, |
|
| 386 | + 'content' => NULL, |
|
| 387 | + 'sidebar_first' => NULL, |
|
| 388 | 388 | ), |
| 389 | - ); |
|
| 390 | - $display->cache = array(); |
|
| 391 | - $display->title = 'Account'; |
|
| 392 | - $display->storage_type = 'page_manager'; |
|
| 393 | - $display->storage_id = 'page_boinc_user_panel_context_2'; |
|
| 394 | - $display->content = array(); |
|
| 395 | - $display->panels = array(); |
|
| 389 | + ); |
|
| 390 | + $display->cache = array(); |
|
| 391 | + $display->title = 'Account'; |
|
| 392 | + $display->storage_type = 'page_manager'; |
|
| 393 | + $display->storage_id = 'page_boinc_user_panel_context_2'; |
|
| 394 | + $display->content = array(); |
|
| 395 | + $display->panels = array(); |
|
| 396 | 396 | $pane = new stdClass; |
| 397 | 397 | $pane->pid = 'new-1'; |
| 398 | 398 | $pane->panel = 'content'; |
@@ -401,19 +401,19 @@ discard block |
||
| 401 | 401 | $pane->shown = TRUE; |
| 402 | 402 | $pane->access = array(); |
| 403 | 403 | $pane->configuration = array( |
| 404 | - 'context' => array( |
|
| 404 | + 'context' => array( |
|
| 405 | 405 | 0 => 'argument_uid_1', |
| 406 | - ), |
|
| 407 | - 'override_title' => 0, |
|
| 408 | - 'override_title_text' => '', |
|
| 406 | + ), |
|
| 407 | + 'override_title' => 0, |
|
| 408 | + 'override_title_text' => '', |
|
| 409 | 409 | ); |
| 410 | 410 | $pane->cache = array(); |
| 411 | 411 | $pane->style = array( |
| 412 | - 'settings' => NULL, |
|
| 412 | + 'settings' => NULL, |
|
| 413 | 413 | ); |
| 414 | 414 | $pane->css = array( |
| 415 | - 'css_id' => '', |
|
| 416 | - 'css_class' => 'panel-primary container shadow', |
|
| 415 | + 'css_id' => '', |
|
| 416 | + 'css_class' => 'panel-primary container shadow', |
|
| 417 | 417 | ); |
| 418 | 418 | $pane->extras = array(); |
| 419 | 419 | $pane->position = 0; |
@@ -427,16 +427,16 @@ discard block |
||
| 427 | 427 | $pane->shown = TRUE; |
| 428 | 428 | $pane->access = array(); |
| 429 | 429 | $pane->configuration = array( |
| 430 | - 'override_title' => 0, |
|
| 431 | - 'override_title_text' => '', |
|
| 430 | + 'override_title' => 0, |
|
| 431 | + 'override_title_text' => '', |
|
| 432 | 432 | ); |
| 433 | 433 | $pane->cache = array(); |
| 434 | 434 | $pane->style = array( |
| 435 | - 'settings' => NULL, |
|
| 435 | + 'settings' => NULL, |
|
| 436 | 436 | ); |
| 437 | 437 | $pane->css = array( |
| 438 | - 'css_id' => '', |
|
| 439 | - 'css_class' => 'panel-secondary container shadow', |
|
| 438 | + 'css_id' => '', |
|
| 439 | + 'css_class' => 'panel-secondary container shadow', |
|
| 440 | 440 | ); |
| 441 | 441 | $pane->extras = array(); |
| 442 | 442 | $pane->position = 0; |
@@ -450,23 +450,23 @@ discard block |
||
| 450 | 450 | $pane->shown = TRUE; |
| 451 | 451 | $pane->access = array(); |
| 452 | 452 | $pane->configuration = array( |
| 453 | - 'admin_title' => 'Team summary', |
|
| 454 | - 'title' => '', |
|
| 455 | - 'body' => '<?php |
|
| 453 | + 'admin_title' => 'Team summary', |
|
| 454 | + 'title' => '', |
|
| 455 | + 'body' => '<?php |
|
| 456 | 456 | if (module_exists(\'boincteam\')) { |
| 457 | 457 | echo boincteam_dashboard_panel(%user:uid); |
| 458 | 458 | } |
| 459 | 459 | ?>', |
| 460 | - 'format' => '3', |
|
| 461 | - 'substitute' => 1, |
|
| 460 | + 'format' => '3', |
|
| 461 | + 'substitute' => 1, |
|
| 462 | 462 | ); |
| 463 | 463 | $pane->cache = array(); |
| 464 | 464 | $pane->style = array( |
| 465 | - 'settings' => NULL, |
|
| 465 | + 'settings' => NULL, |
|
| 466 | 466 | ); |
| 467 | 467 | $pane->css = array( |
| 468 | - 'css_id' => 'team-dashboard-pane', |
|
| 469 | - 'css_class' => 'panel-secondary container shadow', |
|
| 468 | + 'css_id' => 'team-dashboard-pane', |
|
| 469 | + 'css_class' => 'panel-secondary container shadow', |
|
| 470 | 470 | ); |
| 471 | 471 | $pane->extras = array(); |
| 472 | 472 | $pane->position = 1; |
@@ -480,9 +480,9 @@ discard block |
||
| 480 | 480 | $pane->shown = TRUE; |
| 481 | 481 | $pane->access = array(); |
| 482 | 482 | $pane->configuration = array( |
| 483 | - 'admin_title' => 'User activity summary', |
|
| 484 | - 'title' => '', |
|
| 485 | - 'body' => '<?php |
|
| 483 | + 'admin_title' => 'User activity summary', |
|
| 484 | + 'title' => '', |
|
| 485 | + 'body' => '<?php |
|
| 486 | 486 | |
| 487 | 487 | $uid = arg(1); |
| 488 | 488 | $account = user_load($uid); |
@@ -490,16 +490,16 @@ discard block |
||
| 490 | 490 | echo \'<div class="item-count-wrapper"><div class="item-count">\' . $account->post_count . \'</div></div>\'; |
| 491 | 491 | |
| 492 | 492 | ?>', |
| 493 | - 'format' => '3', |
|
| 494 | - 'substitute' => 0, |
|
| 493 | + 'format' => '3', |
|
| 494 | + 'substitute' => 0, |
|
| 495 | 495 | ); |
| 496 | 496 | $pane->cache = array(); |
| 497 | 497 | $pane->style = array( |
| 498 | - 'settings' => NULL, |
|
| 498 | + 'settings' => NULL, |
|
| 499 | 499 | ); |
| 500 | 500 | $pane->css = array( |
| 501 | - 'css_id' => '', |
|
| 502 | - 'css_class' => 'panel-secondary container shadow', |
|
| 501 | + 'css_id' => '', |
|
| 502 | + 'css_class' => 'panel-secondary container shadow', |
|
| 503 | 503 | ); |
| 504 | 504 | $pane->extras = array(); |
| 505 | 505 | $pane->position = 2; |
@@ -513,31 +513,31 @@ discard block |
||
| 513 | 513 | $pane->shown = TRUE; |
| 514 | 514 | $pane->access = array(); |
| 515 | 515 | $pane->configuration = array( |
| 516 | - 'override_pager_settings' => 0, |
|
| 517 | - 'use_pager' => 0, |
|
| 518 | - 'nodes_per_page' => '6', |
|
| 519 | - 'pager_id' => '', |
|
| 520 | - 'offset' => '0', |
|
| 521 | - 'more_link' => 0, |
|
| 522 | - 'feed_icons' => 0, |
|
| 523 | - 'panel_args' => 0, |
|
| 524 | - 'link_to_view' => 0, |
|
| 525 | - 'args' => '', |
|
| 526 | - 'url' => '', |
|
| 527 | - 'display' => 'block_1', |
|
| 528 | - 'context' => array( |
|
| 516 | + 'override_pager_settings' => 0, |
|
| 517 | + 'use_pager' => 0, |
|
| 518 | + 'nodes_per_page' => '6', |
|
| 519 | + 'pager_id' => '', |
|
| 520 | + 'offset' => '0', |
|
| 521 | + 'more_link' => 0, |
|
| 522 | + 'feed_icons' => 0, |
|
| 523 | + 'panel_args' => 0, |
|
| 524 | + 'link_to_view' => 0, |
|
| 525 | + 'args' => '', |
|
| 526 | + 'url' => '', |
|
| 527 | + 'display' => 'block_1', |
|
| 528 | + 'context' => array( |
|
| 529 | 529 | 0 => 'argument_uid_1.uid', |
| 530 | - ), |
|
| 531 | - 'override_title' => 0, |
|
| 532 | - 'override_title_text' => '', |
|
| 530 | + ), |
|
| 531 | + 'override_title' => 0, |
|
| 532 | + 'override_title_text' => '', |
|
| 533 | 533 | ); |
| 534 | 534 | $pane->cache = array(); |
| 535 | 535 | $pane->style = array( |
| 536 | - 'settings' => NULL, |
|
| 536 | + 'settings' => NULL, |
|
| 537 | 537 | ); |
| 538 | 538 | $pane->css = array( |
| 539 | - 'css_id' => '', |
|
| 540 | - 'css_class' => 'panel-secondary container shadow', |
|
| 539 | + 'css_id' => '', |
|
| 540 | + 'css_class' => 'panel-secondary container shadow', |
|
| 541 | 541 | ); |
| 542 | 542 | $pane->extras = array(); |
| 543 | 543 | $pane->position = 3; |
@@ -551,66 +551,66 @@ discard block |
||
| 551 | 551 | $pane->shown = TRUE; |
| 552 | 552 | $pane->access = array(); |
| 553 | 553 | $pane->configuration = array( |
| 554 | - 'admin_title' => 'Project list', |
|
| 555 | - 'title' => 'Projects', |
|
| 556 | - 'body' => '<?php echo boincuser_get_projects_table(%user:uid); ?>', |
|
| 557 | - 'format' => '3', |
|
| 558 | - 'substitute' => 1, |
|
| 554 | + 'admin_title' => 'Project list', |
|
| 555 | + 'title' => 'Projects', |
|
| 556 | + 'body' => '<?php echo boincuser_get_projects_table(%user:uid); ?>', |
|
| 557 | + 'format' => '3', |
|
| 558 | + 'substitute' => 1, |
|
| 559 | 559 | ); |
| 560 | 560 | $pane->cache = array(); |
| 561 | 561 | $pane->style = array( |
| 562 | - 'settings' => NULL, |
|
| 562 | + 'settings' => NULL, |
|
| 563 | 563 | ); |
| 564 | 564 | $pane->css = array( |
| 565 | - 'css_id' => '', |
|
| 566 | - 'css_class' => 'panel-secondary container shadow', |
|
| 565 | + 'css_id' => '', |
|
| 566 | + 'css_class' => 'panel-secondary container shadow', |
|
| 567 | 567 | ); |
| 568 | 568 | $pane->extras = array(); |
| 569 | 569 | $pane->position = 4; |
| 570 | 570 | $display->content['new-6'] = $pane; |
| 571 | 571 | $display->panels['sidebar_first'][4] = 'new-6'; |
| 572 | - $display->hide_title = PANELS_TITLE_FIXED; |
|
| 573 | - $display->title_pane = '0'; |
|
| 574 | - $handler->conf['display'] = $display; |
|
| 575 | - $page->default_handlers[$handler->name] = $handler; |
|
| 576 | - $pages['boinc_user'] = $page; |
|
| 572 | + $display->hide_title = PANELS_TITLE_FIXED; |
|
| 573 | + $display->title_pane = '0'; |
|
| 574 | + $handler->conf['display'] = $display; |
|
| 575 | + $page->default_handlers[$handler->name] = $handler; |
|
| 576 | + $pages['boinc_user'] = $page; |
|
| 577 | 577 | |
| 578 | - $page = new stdClass; |
|
| 579 | - $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 580 | - $page->api_version = 1; |
|
| 581 | - $page->name = 'home'; |
|
| 582 | - $page->task = 'page'; |
|
| 583 | - $page->admin_title = 'Home page'; |
|
| 584 | - $page->admin_description = ''; |
|
| 585 | - $page->path = 'home'; |
|
| 586 | - $page->access = array( |
|
| 578 | + $page = new stdClass; |
|
| 579 | + $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */ |
|
| 580 | + $page->api_version = 1; |
|
| 581 | + $page->name = 'home'; |
|
| 582 | + $page->task = 'page'; |
|
| 583 | + $page->admin_title = 'Home page'; |
|
| 584 | + $page->admin_description = ''; |
|
| 585 | + $page->path = 'home'; |
|
| 586 | + $page->access = array( |
|
| 587 | 587 | 'type' => 'none', |
| 588 | 588 | 'settings' => NULL, |
| 589 | - ); |
|
| 590 | - $page->menu = array( |
|
| 589 | + ); |
|
| 590 | + $page->menu = array( |
|
| 591 | 591 | 'type' => 'normal', |
| 592 | 592 | 'title' => 'Home', |
| 593 | 593 | 'name' => 'navigation', |
| 594 | 594 | 'weight' => '0', |
| 595 | 595 | 'parent' => array( |
| 596 | - 'type' => 'none', |
|
| 597 | - 'title' => '', |
|
| 598 | - 'name' => 'navigation', |
|
| 599 | - 'weight' => '0', |
|
| 596 | + 'type' => 'none', |
|
| 597 | + 'title' => '', |
|
| 598 | + 'name' => 'navigation', |
|
| 599 | + 'weight' => '0', |
|
| 600 | 600 | ), |
| 601 | - ); |
|
| 602 | - $page->arguments = array(); |
|
| 603 | - $page->conf = array(); |
|
| 604 | - $page->default_handlers = array(); |
|
| 605 | - $handler = new stdClass; |
|
| 606 | - $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
| 607 | - $handler->api_version = 1; |
|
| 608 | - $handler->name = 'page_home_panel_context'; |
|
| 609 | - $handler->task = 'page'; |
|
| 610 | - $handler->subtask = 'home'; |
|
| 611 | - $handler->handler = 'panel_context'; |
|
| 612 | - $handler->weight = 0; |
|
| 613 | - $handler->conf = array( |
|
| 601 | + ); |
|
| 602 | + $page->arguments = array(); |
|
| 603 | + $page->conf = array(); |
|
| 604 | + $page->default_handlers = array(); |
|
| 605 | + $handler = new stdClass; |
|
| 606 | + $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */ |
|
| 607 | + $handler->api_version = 1; |
|
| 608 | + $handler->name = 'page_home_panel_context'; |
|
| 609 | + $handler->task = 'page'; |
|
| 610 | + $handler->subtask = 'home'; |
|
| 611 | + $handler->handler = 'panel_context'; |
|
| 612 | + $handler->weight = 0; |
|
| 613 | + $handler->conf = array( |
|
| 614 | 614 | 'title' => 'Landing page', |
| 615 | 615 | 'no_blocks' => FALSE, |
| 616 | 616 | 'pipeline' => 'ipe', |
@@ -618,23 +618,23 @@ discard block |
||
| 618 | 618 | 'css' => '', |
| 619 | 619 | 'contexts' => array(), |
| 620 | 620 | 'relationships' => array(), |
| 621 | - ); |
|
| 622 | - $display = new panels_display; |
|
| 623 | - $display->layout = 'one_sidebar_second'; |
|
| 624 | - $display->layout_settings = array(); |
|
| 625 | - $display->panel_settings = array( |
|
| 621 | + ); |
|
| 622 | + $display = new panels_display; |
|
| 623 | + $display->layout = 'one_sidebar_second'; |
|
| 624 | + $display->layout_settings = array(); |
|
| 625 | + $display->panel_settings = array( |
|
| 626 | 626 | 'style_settings' => array( |
| 627 | - 'default' => NULL, |
|
| 628 | - 'content' => NULL, |
|
| 629 | - 'sidebar_first' => NULL, |
|
| 627 | + 'default' => NULL, |
|
| 628 | + 'content' => NULL, |
|
| 629 | + 'sidebar_first' => NULL, |
|
| 630 | 630 | ), |
| 631 | - ); |
|
| 632 | - $display->cache = array(); |
|
| 633 | - $display->title = ''; |
|
| 634 | - $display->storage_type = 'page_manager'; |
|
| 635 | - $display->storage_id = 'page_home_panel_context'; |
|
| 636 | - $display->content = array(); |
|
| 637 | - $display->panels = array(); |
|
| 631 | + ); |
|
| 632 | + $display->cache = array(); |
|
| 633 | + $display->title = ''; |
|
| 634 | + $display->storage_type = 'page_manager'; |
|
| 635 | + $display->storage_id = 'page_home_panel_context'; |
|
| 636 | + $display->content = array(); |
|
| 637 | + $display->panels = array(); |
|
| 638 | 638 | $pane = new stdClass; |
| 639 | 639 | $pane->pid = 'new-1'; |
| 640 | 640 | $pane->panel = 'content'; |
@@ -642,22 +642,22 @@ discard block |
||
| 642 | 642 | $pane->subtype = 'custom'; |
| 643 | 643 | $pane->shown = TRUE; |
| 644 | 644 | $pane->access = array( |
| 645 | - 'plugins' => array(), |
|
| 645 | + 'plugins' => array(), |
|
| 646 | 646 | ); |
| 647 | 647 | $pane->configuration = array( |
| 648 | - 'admin_title' => 'BOINC overview', |
|
| 649 | - 'title' => '', |
|
| 650 | - 'body' => '<?php print boincuser_home_page(); ?>', |
|
| 651 | - 'format' => '3', |
|
| 652 | - 'substitute' => TRUE, |
|
| 648 | + 'admin_title' => 'BOINC overview', |
|
| 649 | + 'title' => '', |
|
| 650 | + 'body' => '<?php print boincuser_home_page(); ?>', |
|
| 651 | + 'format' => '3', |
|
| 652 | + 'substitute' => TRUE, |
|
| 653 | 653 | ); |
| 654 | 654 | $pane->cache = array(); |
| 655 | 655 | $pane->style = array( |
| 656 | - 'settings' => NULL, |
|
| 656 | + 'settings' => NULL, |
|
| 657 | 657 | ); |
| 658 | 658 | $pane->css = array( |
| 659 | - 'css_id' => '', |
|
| 660 | - 'css_class' => 'panel-primary container shadow', |
|
| 659 | + 'css_id' => '', |
|
| 660 | + 'css_class' => 'panel-primary container shadow', |
|
| 661 | 661 | ); |
| 662 | 662 | $pane->extras = array(); |
| 663 | 663 | $pane->position = 0; |
@@ -671,16 +671,16 @@ discard block |
||
| 671 | 671 | $pane->shown = TRUE; |
| 672 | 672 | $pane->access = array(); |
| 673 | 673 | $pane->configuration = array( |
| 674 | - 'override_title' => 0, |
|
| 675 | - 'override_title_text' => '', |
|
| 674 | + 'override_title' => 0, |
|
| 675 | + 'override_title_text' => '', |
|
| 676 | 676 | ); |
| 677 | 677 | $pane->cache = array(); |
| 678 | 678 | $pane->style = array( |
| 679 | - 'settings' => NULL, |
|
| 679 | + 'settings' => NULL, |
|
| 680 | 680 | ); |
| 681 | 681 | $pane->css = array( |
| 682 | - 'css_id' => '', |
|
| 683 | - 'css_class' => 'panel-secondary container shadow balance-height-front no-resize', |
|
| 682 | + 'css_id' => '', |
|
| 683 | + 'css_class' => 'panel-secondary container shadow balance-height-front no-resize', |
|
| 684 | 684 | ); |
| 685 | 685 | $pane->extras = array(); |
| 686 | 686 | $pane->position = 0; |
@@ -694,39 +694,39 @@ discard block |
||
| 694 | 694 | $pane->shown = TRUE; |
| 695 | 695 | $pane->access = array(); |
| 696 | 696 | $pane->configuration = array( |
| 697 | - 'override_pager_settings' => 1, |
|
| 698 | - 'use_pager' => 0, |
|
| 699 | - 'nodes_per_page' => '2', |
|
| 700 | - 'pager_id' => '', |
|
| 701 | - 'offset' => '0', |
|
| 702 | - 'more_link' => 1, |
|
| 703 | - 'feed_icons' => 1, |
|
| 704 | - 'panel_args' => 0, |
|
| 705 | - 'link_to_view' => 0, |
|
| 706 | - 'args' => '', |
|
| 707 | - 'url' => '', |
|
| 708 | - 'display' => 'page_2', |
|
| 709 | - 'override_title' => 1, |
|
| 710 | - 'override_title_text' => '', |
|
| 697 | + 'override_pager_settings' => 1, |
|
| 698 | + 'use_pager' => 0, |
|
| 699 | + 'nodes_per_page' => '2', |
|
| 700 | + 'pager_id' => '', |
|
| 701 | + 'offset' => '0', |
|
| 702 | + 'more_link' => 1, |
|
| 703 | + 'feed_icons' => 1, |
|
| 704 | + 'panel_args' => 0, |
|
| 705 | + 'link_to_view' => 0, |
|
| 706 | + 'args' => '', |
|
| 707 | + 'url' => '', |
|
| 708 | + 'display' => 'page_2', |
|
| 709 | + 'override_title' => 1, |
|
| 710 | + 'override_title_text' => '', |
|
| 711 | 711 | ); |
| 712 | 712 | $pane->cache = array(); |
| 713 | 713 | $pane->style = array( |
| 714 | - 'settings' => NULL, |
|
| 714 | + 'settings' => NULL, |
|
| 715 | 715 | ); |
| 716 | 716 | $pane->css = array( |
| 717 | - 'css_id' => '', |
|
| 718 | - 'css_class' => 'panel-secondary container shadow balance-height-front', |
|
| 717 | + 'css_id' => '', |
|
| 718 | + 'css_class' => 'panel-secondary container shadow balance-height-front', |
|
| 719 | 719 | ); |
| 720 | 720 | $pane->extras = array(); |
| 721 | 721 | $pane->position = 1; |
| 722 | 722 | $display->content['new-3'] = $pane; |
| 723 | 723 | $display->panels['sidebar_first'][1] = 'new-3'; |
| 724 | - $display->hide_title = PANELS_TITLE_NONE; |
|
| 725 | - $display->title_pane = '0'; |
|
| 726 | - $handler->conf['display'] = $display; |
|
| 727 | - $page->default_handlers[$handler->name] = $handler; |
|
| 728 | - $pages['home'] = $page; |
|
| 724 | + $display->hide_title = PANELS_TITLE_NONE; |
|
| 725 | + $display->title_pane = '0'; |
|
| 726 | + $handler->conf['display'] = $display; |
|
| 727 | + $page->default_handlers[$handler->name] = $handler; |
|
| 728 | + $pages['home'] = $page; |
|
| 729 | 729 | |
| 730 | - return $pages; |
|
| 730 | + return $pages; |
|
| 731 | 731 | |
| 732 | 732 | } |
@@ -13,45 +13,45 @@ discard block |
||
| 13 | 13 | * a form array |
| 14 | 14 | */ |
| 15 | 15 | function boincuser_delete_settings() { |
| 16 | - $form = array(); |
|
| 16 | + $form = array(); |
|
| 17 | 17 | |
| 18 | - $default = array( |
|
| 18 | + $default = array( |
|
| 19 | 19 | 'boincuser_delete_type' => variable_get('boincuser_delete_type', ''), |
| 20 | 20 | 'boincuser_delete_redirect' => variable_get('boincuser_delete_redirect', '<front>'), |
| 21 | - ); |
|
| 21 | + ); |
|
| 22 | 22 | |
| 23 | - $form['options'] = array( |
|
| 23 | + $form['options'] = array( |
|
| 24 | 24 | '#type' => 'fieldset', |
| 25 | 25 | '#title' => t('Options'), |
| 26 | - ); |
|
| 27 | - $form['options']['help'] = array( |
|
| 26 | + ); |
|
| 27 | + $form['options']['help'] = array( |
|
| 28 | 28 | '#value' => t('When a user deletes their account, which option is shown to the user? A soft/obfusate delete, a hard/wipe delete, or let the user chose between the two.'), |
| 29 | 29 | '#weight' => 11, |
| 30 | - ); |
|
| 31 | - $form['options']['boincuser_delete_type'] = array( |
|
| 30 | + ); |
|
| 31 | + $form['options']['boincuser_delete_type'] = array( |
|
| 32 | 32 | '#type' => 'radios', |
| 33 | 33 | '#title' => t('Type of delete'), |
| 34 | 34 | '#default_value' => $default['boincuser_delete_type'], |
| 35 | 35 | '#options' => array( |
| 36 | - 'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'), |
|
| 37 | - 'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'), |
|
| 38 | - 'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'), |
|
| 36 | + 'soft_obfuscate' => t('A soft/obfuscate delete. User\'s account is disabled, but some data is deleted.'), |
|
| 37 | + 'hard_wipe' => t('A hard/wipe delete. User\'s account is deleted along with many data.'), |
|
| 38 | + 'user_decides' => t('User is presented with radio buttons where they choose between the two options above.'), |
|
| 39 | 39 | ), |
| 40 | 40 | '#weight' => 21, |
| 41 | - ); |
|
| 41 | + ); |
|
| 42 | 42 | |
| 43 | - $form['redirect'] = array( |
|
| 43 | + $form['redirect'] = array( |
|
| 44 | 44 | '#type' => 'fieldset', |
| 45 | 45 | '#title' => t('Redirect'), |
| 46 | - ); |
|
| 47 | - $form['redirect']['boincuser_delete_redirect'] = array( |
|
| 46 | + ); |
|
| 47 | + $form['redirect']['boincuser_delete_redirect'] = array( |
|
| 48 | 48 | '#type' => 'textfield', |
| 49 | 49 | '#title' => t('Redirection page'), |
| 50 | 50 | '#default_value' => $default['boincuser_delete_redirect'], |
| 51 | 51 | '#description' => t('Choose where to redirect your users after account deletion. Any valid Drupal path will do, e.g. %front or %node', array('%front' => '<front>', '%node' => 'node/1')), |
| 52 | - ); |
|
| 52 | + ); |
|
| 53 | 53 | |
| 54 | - return system_settings_form($form); |
|
| 54 | + return system_settings_form($form); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -60,124 +60,124 @@ discard block |
||
| 60 | 60 | * password checks. |
| 61 | 61 | */ |
| 62 | 62 | function boincuser_delete_admindelete(&$form_state, $uid) { |
| 63 | - $form = array(); |
|
| 63 | + $form = array(); |
|
| 64 | 64 | |
| 65 | - $form['#uid'] = $uid; |
|
| 65 | + $form['#uid'] = $uid; |
|
| 66 | 66 | |
| 67 | - $form['account']['help'] = array( |
|
| 67 | + $form['account']['help'] = array( |
|
| 68 | 68 | '#value' => "<p>" . t("This form will delete this user <strong>without any email notification</strong> sent to the user. Be very careful in deleting users using this form. Once you select the delete type, check the checkbox, enter your password, and click submit, the user's account will be deleted. This will occur <strong>immediately</strong>. There is no 'undo'!") . "</p><p>" . t("You are deleting the following user, link opens in new window:") . "</p>", |
| 69 | 69 | '#weight' => -1, |
| 70 | 70 | '#prefix' => "<div id='delete-instructions'>", |
| 71 | 71 | '#suffix' => "</div>", |
| 72 | - ); |
|
| 72 | + ); |
|
| 73 | 73 | |
| 74 | - $account = user_load($uid); |
|
| 75 | - if ($account) { |
|
| 74 | + $account = user_load($uid); |
|
| 75 | + if ($account) { |
|
| 76 | 76 | drupal_set_title($account->boincuser_name); |
| 77 | 77 | |
| 78 | 78 | $form['account']['boincuser_name'] = array( |
| 79 | - '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
| 79 | + '#value' => t('<li>BOINC username (public displayname): ') . l("{$account->boincuser_name}", "account/{$account->uid}", array('attributes' => array('target' => '_blank'))), |
|
| 80 | 80 | ); |
| 81 | 81 | $form['account']['boincuser_id'] = array( |
| 82 | - '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
| 82 | + '#value' => t('<li>BOINC user ID: ') . $account->boincuser_id, |
|
| 83 | 83 | ); |
| 84 | 84 | $form['account']['drupal_name'] = array( |
| 85 | - '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
| 85 | + '#value' => t('<li>Drupal username (internal): ') . $account->name, |
|
| 86 | 86 | ); |
| 87 | 87 | $form['account']['user_id'] = array( |
| 88 | - '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
| 88 | + '#value' => t('<li>Drupal user ID: ') . $account->uid, |
|
| 89 | 89 | ); |
| 90 | 90 | |
| 91 | 91 | $form['account']['user_delete_action'] = array( |
| 92 | 92 | '#type' => 'radios', |
| 93 | 93 | '#options' => array( |
| 94 | - 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
| 95 | - 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
| 96 | - ); |
|
| 94 | + 'soft_obfuscate' => bts('<b>Soft delete</b> the account. The account will be disabled, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted, the host information deleted, and the user will be removed from any team.', array(), NULL, 'boinc:delete-user-account'), |
|
| 95 | + 'hard_wipe' => bts('<b>Delete</b> the account. The account will be deleted, and all posts/comments will be attributed to the Anonymous User. The user profile will be deleted.', array(), NULL, 'boinc:delete-user-account'),), |
|
| 96 | + ); |
|
| 97 | 97 | |
| 98 | 98 | $form['account']['surecheckbox'] = array( |
| 99 | - '#type' => 'checkbox', |
|
| 100 | - '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
|
| 99 | + '#type' => 'checkbox', |
|
| 100 | + '#title' => t('I am <strong>sure</strong> I know what I am doing. I am <u><strong>deleting user</strong></u> %name.', |
|
| 101 | 101 | array('%name' => $account->boincuser_name) |
| 102 | - ), |
|
| 103 | - '#default_value' => FALSE, |
|
| 102 | + ), |
|
| 103 | + '#default_value' => FALSE, |
|
| 104 | 104 | ); |
| 105 | 105 | |
| 106 | 106 | $form['account']['current_pass'] = array( |
| 107 | - '#type' => 'password', |
|
| 108 | - '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
| 109 | - '#size' => 17, |
|
| 110 | - '#attributes' => array( |
|
| 107 | + '#type' => 'password', |
|
| 108 | + '#title' => bts('Enter your password before clicking Submit, or click Cancel to return to the user\'s edit page', array(), NULL, 'boinc:delete-user-account'), |
|
| 109 | + '#size' => 17, |
|
| 110 | + '#attributes' => array( |
|
| 111 | 111 | 'autocomplete' => 'off', |
| 112 | - ), |
|
| 113 | - '#weight' => 25, |
|
| 112 | + ), |
|
| 113 | + '#weight' => 25, |
|
| 114 | 114 | ); |
| 115 | 115 | |
| 116 | 116 | // Action buttons |
| 117 | 117 | $form['actions']['submit'] = array( |
| 118 | - '#type' => 'submit', |
|
| 119 | - '#value' => t('Submit'), |
|
| 118 | + '#type' => 'submit', |
|
| 119 | + '#value' => t('Submit'), |
|
| 120 | 120 | ); |
| 121 | 121 | $form['actions']['cancel'] = array( |
| 122 | - '#type' => 'button', |
|
| 123 | - '#value' => t('Cancel'), |
|
| 124 | - '#executes_submit_callback' => TRUE, |
|
| 125 | - '#validate' => array(), |
|
| 126 | - '#submit' => array('_boincuser_delete_cancel'), |
|
| 122 | + '#type' => 'button', |
|
| 123 | + '#value' => t('Cancel'), |
|
| 124 | + '#executes_submit_callback' => TRUE, |
|
| 125 | + '#validate' => array(), |
|
| 126 | + '#submit' => array('_boincuser_delete_cancel'), |
|
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | $form['#redirect'] = 'account'; |
| 130 | - } |
|
| 131 | - else { |
|
| 130 | + } |
|
| 131 | + else { |
|
| 132 | 132 | $form['noaccount'] = array( |
| 133 | - '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
|
| 133 | + '#value' => t('No such user with UID: %uid', array('%uid' => $uid)), |
|
| 134 | 134 | ); |
| 135 | - } |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | - return $form; |
|
| 137 | + return $form; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Validation function for admin delete user. |
| 142 | 142 | */ |
| 143 | 143 | function boincuser_delete_admindelete_validate($form, &$form_state) { |
| 144 | - global $user; |
|
| 145 | - $boinc_user = boincuser_load($user->uid, TRUE); |
|
| 144 | + global $user; |
|
| 145 | + $boinc_user = boincuser_load($user->uid, TRUE); |
|
| 146 | 146 | |
| 147 | - if ($form_state['values']['user_delete_action'] == '') { |
|
| 147 | + if ($form_state['values']['user_delete_action'] == '') { |
|
| 148 | 148 | form_set_error('user_delete_action', t('Please select an action to perform using the radio buttons.')); |
| 149 | - } |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
| 151 | + if ( ($form_state['values']['user_delete_action'] != 'soft_obfuscate') and ($form_state['values']['user_delete_action'] != 'hard_wipe') ) { |
|
| 152 | 152 | form_set_error('user_delete_action', t('User Delete action not a predefined value, unknown error in radio buttons.')); |
| 153 | - } |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - if (!($form_state['values']['surecheckbox'])) { |
|
| 155 | + if (!($form_state['values']['surecheckbox'])) { |
|
| 156 | 156 | return form_set_error('surecheckbox', t('Please confirm you are sure you want to delete this account.')); |
| 157 | - } |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
| 159 | + if (_boincuser_delete_validatepasswd($boinc_user, $form_state['values']['current_pass'])) { |
|
| 160 | 160 | return true; |
| 161 | - } |
|
| 161 | + } |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * Submit function for admin delete user. |
| 166 | 166 | */ |
| 167 | 167 | function boincuser_delete_admindelete_submit($form, &$form_state) { |
| 168 | - // This is the account to be deleted, and not the administrator's |
|
| 169 | - // account. |
|
| 170 | - $account = user_load(array('uid' => $form['#uid'])); |
|
| 171 | - $action = $form_state['values']['user_delete_action']; |
|
| 168 | + // This is the account to be deleted, and not the administrator's |
|
| 169 | + // account. |
|
| 170 | + $account = user_load(array('uid' => $form['#uid'])); |
|
| 171 | + $action = $form_state['values']['user_delete_action']; |
|
| 172 | 172 | |
| 173 | - drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.', |
|
| 173 | + drupal_set_message(t('WARNING: Account @displayname, Drupal UID=@uid has been deleted.', |
|
| 174 | 174 | array( |
| 175 | - '@uid' => $form['#uid'], |
|
| 176 | - '@displayname' => $account->boincuser_name, |
|
| 175 | + '@uid' => $form['#uid'], |
|
| 176 | + '@displayname' => $account->boincuser_name, |
|
| 177 | 177 | )), 'warning'); |
| 178 | 178 | |
| 179 | - // Delete the user |
|
| 180 | - _boincuser_delete_deleteuser($account, $action); |
|
| 179 | + // Delete the user |
|
| 180 | + _boincuser_delete_deleteuser($account, $action); |
|
| 181 | 181 | |
| 182 | - drupal_goto('/admin/boinc/user_delete'); |
|
| 182 | + drupal_goto('/admin/boinc/user_delete'); |
|
| 183 | 183 | } |