diff --git a/modules/groups/groups_homepage/groups_homepage.css b/modules/groups/groups_homepage/groups_homepage.css new file mode 100644 index 0000000..2047347 --- /dev/null +++ b/modules/groups/groups_homepage/groups_homepage.css @@ -0,0 +1,23 @@ +#community-map { + background: url(world-map.png); + width: 450px; + height: 250px; + overflow: hidden; + margin-bottom: 2em; +} + +#community-map .community-map-pin { + position: relative; +} + +#community-map .community-map-pin span.latitude, +#community-map .community-map-pin span.longitude { + display: none; +} + +#community-map .content { + background: #E0E0E0; + font-size: 80%; + display: inline; + padding: 2px; +} \ No newline at end of file diff --git a/modules/groups/groups_homepage/groups_homepage.js b/modules/groups/groups_homepage/groups_homepage.js new file mode 100644 index 0000000..464c93e --- /dev/null +++ b/modules/groups/groups_homepage/groups_homepage.js @@ -0,0 +1,19 @@ +/** + * Relocate html map pinpoints based on lat and long data. + */ +(function($) { + Drupal.behaviors.groups_homepage = { + attach : function(context) { + console.log("ready!"); + var communityMap = $("#community-map"); + communityMap.find(".community-map-pin").each(function() { + var lat = new Number($(this).find("span.latitude").text()); + var lng = new Number($(this).find("span.longitude").text()); + longPx = ((communityMap.width()/360) * (180 + lng)); + latPx = ((communityMap.height()/180) * (90 - lat)); + $(this).css('top', latPx + "px"); + $(this).css('left', longPx + "px"); + }); + } + } +})(jQuery); \ No newline at end of file diff --git a/modules/groups/groups_homepage/groups_homepage.module b/modules/groups/groups_homepage/groups_homepage.module index 415af8f..3671334 100644 --- a/modules/groups/groups_homepage/groups_homepage.module +++ b/modules/groups/groups_homepage/groups_homepage.module @@ -14,6 +14,18 @@ function groups_homepage_block_info() { 'info' => t('Groups welcome block'), 'cache' => DRUPAL_CACHE_GLOBAL, ); + $blocks['groups_community_map'] = array( + 'info' => t('Groups community map'), + 'cache' => DRUPAL_CACHE_GLOBAL, + ); + $blocks['groups_community_stats']= array( + 'info' => t('Groups community stats'), + 'cache' => DRUPAL_CACHE_GLOBAL, + ); + $blocks['groups_find_nearby']= array( + 'info' => t('Groups find nearby'), + 'cache' => DRUPAL_CACHE_GLOBAL, + ); return $blocks; } @@ -21,8 +33,33 @@ function groups_homepage_block_info() { * Implements hook_block_view(). */ function groups_homepage_block_view($delta='') { - $block['content'] = variable_get('groups_welcome_body', "Can't find one nearby? Want to start one? The OpenStack International Community team is your main contact point. Join the mailing list and read the HowTo page if you are hosting or want to start a user group with meetups, hackathons and other social events talking about OpenStack and free/libre open source software for the cloud."); - $block['subject'] = variable_get('groups_welcome_title', 'Welcome to OpenStack User Groups!'); + $block = array(); + switch ($delta) { + case 'groups_homepage_welcome': + $block['content'] = variable_get('groups_welcome_body', "Can't find one nearby? Want to start one? The OpenStack International Community team is your main contact point. Join the mailing list and read the HowTo page if you are hosting or want to start a user group with meetups, hackathons and other social events talking about OpenStack and free/libre open source software for the cloud."); + $block['subject'] = variable_get('groups_welcome_title', 'Welcome to OpenStack User Groups!'); + break; + case 'groups_community_map': + $block['content'] = theme('community_map', array()); + $block['subject'] = 'Community map'; + drupal_add_css(drupal_get_path('module', 'groups_homepage') . '/groups_homepage.css'); + drupal_add_js(drupal_get_path('module', 'groups_homepage'). '/groups_homepage.js'); + break; + case 'groups_community_stats': + // TODO: fetch community stats from remote service + $stats = array( + 'people' => 12593, + 'countries' => 131, + 'user-groups' => 58, + ); + $block['subject'] = 'Community stats'; + $block['content'] = theme('community_stats', array('stats' => $stats)); + break; + case 'groups_find_nearby': + $block['content'] = theme('groups_find_nearby', array()); + $block['subject'] = 'Find nearby groups'; + break; + } return $block; } @@ -33,3 +70,29 @@ function groups_homepage_block_view($delta='') { function groups_homepage_menu_alter(&$items) { unset($items['search']); } + +/** + * Implements hook_theme() + * @return multitype:number + */ + +function groups_homepage_theme() { + $module_path = drupal_get_path('module', 'groups_homepage'); + $base = array( + 'path' => "$module_path/templates", + ); + return array( + 'community_stats' => $base + array( + 'template' => 'community_stats', + 'variables' => array('stats' => NULL,), + ), + 'groups_find_nearby' => $base + array( + 'template' => 'groups_find_nearby', + 'variables' => array(), + ), + 'community_map' => $base + array( + 'template' => 'community_map', + 'variables' => array(), + ) + ); +} diff --git a/modules/groups/groups_homepage/groups_homepage.pages_default.inc b/modules/groups/groups_homepage/groups_homepage.pages_default.inc index 14aebf9..fa96470 100644 --- a/modules/groups/groups_homepage/groups_homepage.pages_default.inc +++ b/modules/groups/groups_homepage/groups_homepage.pages_default.inc @@ -52,23 +52,19 @@ function groups_homepage_default_page_manager_pages() { 'relationships' => array(), ); $display = new panels_display(); - $display->layout = 'three_50_25_25'; + $display->layout = 'openstack_front'; $display->layout_settings = array(); $display->panel_settings = array( 'style_settings' => array( 'default' => NULL, - 'two_brick_top' => NULL, - 'two_brick_left_above' => NULL, - 'two_brick_right_above' => NULL, - 'two_brick_middle' => NULL, - 'two_brick_left_below' => NULL, - 'two_brick_right_below' => NULL, - 'two_brick_bottom' => NULL, - 'three_50_25_25_top' => NULL, - 'three_50_25_25_first' => NULL, - 'three_50_25_25_second' => NULL, - 'three_50_25_25_third' => NULL, - 'three_50_25_25_bottom' => NULL, + 'os_top' => NULL, + 'os_left' => NULL, + 'os_center' => NULL, + 'os_right' => NULL, + 'os_middle' => NULL, + 'os_bottom_left' => NULL, + 'os_bottom_right' => NULL, + 'os_bottom' => NULL, ), ); $display->cache = array(); @@ -76,9 +72,72 @@ function groups_homepage_default_page_manager_pages() { $display->uuid = '7a0357d1-bf3b-54e4-b522-6c15eedf8a93'; $display->content = array(); $display->panels = array(); + $pane = new stdClass(); + $pane->pid = 'new-4149ec78-f9ea-2084-5961-19adcd9726c5'; + $pane->panel = 'os_bottom_left'; + $pane->type = 'block'; + $pane->subtype = 'groups_homepage-groups_community_map'; + $pane->shown = TRUE; + $pane->access = array(); + $pane->configuration = array( + 'override_title' => 0, + 'override_title_text' => '', + ); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array(); + $pane->extras = array(); + $pane->position = 0; + $pane->locks = array(); + $pane->uuid = '4149ec78-f9ea-2084-5961-19adcd9726c5'; + $display->content['new-4149ec78-f9ea-2084-5961-19adcd9726c5'] = $pane; + $display->panels['os_bottom_left'][0] = 'new-4149ec78-f9ea-2084-5961-19adcd9726c5'; + $pane = new stdClass(); + $pane->pid = 'new-c2b9e460-b848-d8f4-8153-cf0687afd8ea'; + $pane->panel = 'os_bottom_right'; + $pane->type = 'block'; + $pane->subtype = 'groups_homepage-groups_find_nearby'; + $pane->shown = TRUE; + $pane->access = array(); + $pane->configuration = array( + 'override_title' => 0, + 'override_title_text' => '', + ); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array(); + $pane->extras = array(); + $pane->position = 0; + $pane->locks = array(); + $pane->uuid = 'c2b9e460-b848-d8f4-8153-cf0687afd8ea'; + $display->content['new-c2b9e460-b848-d8f4-8153-cf0687afd8ea'] = $pane; + $display->panels['os_bottom_right'][0] = 'new-c2b9e460-b848-d8f4-8153-cf0687afd8ea'; + $pane = new stdClass(); + $pane->pid = 'new-1a23fada-1c8b-2cf4-2978-e8aa64e28877'; + $pane->panel = 'os_center'; + $pane->type = 'views_panes'; + $pane->subtype = 'commons_activity_streams_activity-panel_pane_1'; + $pane->shown = TRUE; + $pane->access = array(); + $pane->configuration = array(); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array(); + $pane->extras = array(); + $pane->position = 0; + $pane->locks = array(); + $pane->uuid = '1a23fada-1c8b-2cf4-2978-e8aa64e28877'; + $display->content['new-1a23fada-1c8b-2cf4-2978-e8aa64e28877'] = $pane; + $display->panels['os_center'][0] = 'new-1a23fada-1c8b-2cf4-2978-e8aa64e28877'; $pane = new stdClass(); $pane->pid = 'new-dd6ca3f4-3444-af04-f1e2-47c9f488ed53'; - $pane->panel = 'three_50_25_25_first'; + $pane->panel = 'os_left'; $pane->type = 'block'; $pane->subtype = 'groups_homepage-groups_homepage_welcome'; $pane->shown = TRUE; @@ -97,15 +156,18 @@ function groups_homepage_default_page_manager_pages() { $pane->locks = array(); $pane->uuid = 'dd6ca3f4-3444-af04-f1e2-47c9f488ed53'; $display->content['new-dd6ca3f4-3444-af04-f1e2-47c9f488ed53'] = $pane; - $display->panels['three_50_25_25_first'][0] = 'new-dd6ca3f4-3444-af04-f1e2-47c9f488ed53'; + $display->panels['os_left'][0] = 'new-dd6ca3f4-3444-af04-f1e2-47c9f488ed53'; $pane = new stdClass(); - $pane->pid = 'new-1a23fada-1c8b-2cf4-2978-e8aa64e28877'; - $pane->panel = 'three_50_25_25_second'; - $pane->type = 'views_panes'; - $pane->subtype = 'commons_activity_streams_activity-panel_pane_1'; + $pane->pid = 'new-7ae087d4-887e-4b54-b980-44fb87245089'; + $pane->panel = 'os_middle'; + $pane->type = 'block'; + $pane->subtype = 'groups_homepage-groups_community_stats'; $pane->shown = TRUE; $pane->access = array(); - $pane->configuration = array(); + $pane->configuration = array( + 'override_title' => 0, + 'override_title_text' => '', + ); $pane->cache = array(); $pane->style = array( 'settings' => NULL, @@ -114,12 +176,12 @@ function groups_homepage_default_page_manager_pages() { $pane->extras = array(); $pane->position = 0; $pane->locks = array(); - $pane->uuid = '1a23fada-1c8b-2cf4-2978-e8aa64e28877'; - $display->content['new-1a23fada-1c8b-2cf4-2978-e8aa64e28877'] = $pane; - $display->panels['three_50_25_25_second'][0] = 'new-1a23fada-1c8b-2cf4-2978-e8aa64e28877'; + $pane->uuid = '7ae087d4-887e-4b54-b980-44fb87245089'; + $display->content['new-7ae087d4-887e-4b54-b980-44fb87245089'] = $pane; + $display->panels['os_middle'][0] = 'new-7ae087d4-887e-4b54-b980-44fb87245089'; $pane = new stdClass(); $pane->pid = 'new-4f60b089-fac8-aa14-d1f8-d5674b0d51bc'; - $pane->panel = 'three_50_25_25_third'; + $pane->panel = 'os_right'; $pane->type = 'views_panes'; $pane->subtype = 'commons_events_upcoming-panel_pane_2'; $pane->shown = TRUE; @@ -135,7 +197,7 @@ function groups_homepage_default_page_manager_pages() { $pane->locks = array(); $pane->uuid = '4f60b089-fac8-aa14-d1f8-d5674b0d51bc'; $display->content['new-4f60b089-fac8-aa14-d1f8-d5674b0d51bc'] = $pane; - $display->panels['three_50_25_25_third'][0] = 'new-4f60b089-fac8-aa14-d1f8-d5674b0d51bc'; + $display->panels['os_right'][0] = 'new-4f60b089-fac8-aa14-d1f8-d5674b0d51bc'; $display->hide_title = PANELS_TITLE_NONE; $display->title_pane = '0'; $handler->conf['display'] = $display; diff --git a/modules/groups/groups_homepage/templates/community_map.tpl.php b/modules/groups/groups_homepage/templates/community_map.tpl.php new file mode 100644 index 0000000..71f438e --- /dev/null +++ b/modules/groups/groups_homepage/templates/community_map.tpl.php @@ -0,0 +1,35 @@ +
+ Establish a new Openstack User Group in your city. Read our organizer tips About bootstrapping a local group and join to our fast growing vibrant community! +
+ Register new user group +