diff --git a/modules/groups/groups_groups/groups_groups.features.field_base.inc b/modules/groups/groups_groups/groups_groups.features.field_base.inc index 2ac7739..069890f 100644 --- a/modules/groups/groups_groups/groups_groups.features.field_base.inc +++ b/modules/groups/groups_groups/groups_groups.features.field_base.inc @@ -10,6 +10,48 @@ function groups_groups_field_default_field_bases() { $field_bases = array(); + // Exported field_base: 'field_ambassadors' + $field_bases['field_ambassadors'] = array( + 'active' => 1, + 'cardinality' => -1, + 'deleted' => 0, + 'entity_types' => array(), + 'field_name' => 'field_ambassadors', + 'foreign keys' => array( + 'users' => array( + 'columns' => array( + 'target_id' => 'uid', + ), + 'table' => 'users', + ), + ), + 'indexes' => array( + 'target_id' => array( + 0 => 'target_id', + ), + ), + 'locked' => 0, + 'module' => 'entityreference', + 'settings' => array( + 'handler' => 'views', + 'handler_settings' => array( + 'behaviors' => array( + 'views-select-list' => array( + 'status' => 0, + ), + ), + 'view' => array( + 'args' => array(), + 'display_name' => 'entityreference_1', + 'view_name' => 'groups_ambassadors', + ), + ), + 'target_type' => 'user', + ), + 'translatable' => 0, + 'type' => 'entityreference', + ); + // Exported field_base: 'field_geofield' $field_bases['field_geofield'] = array( 'active' => 1, diff --git a/modules/groups/groups_groups/groups_groups.features.field_instance.inc b/modules/groups/groups_groups/groups_groups.features.field_instance.inc index 1d8c6c2..5a66f6e 100644 --- a/modules/groups/groups_groups/groups_groups.features.field_instance.inc +++ b/modules/groups/groups_groups/groups_groups.features.field_instance.inc @@ -10,6 +10,51 @@ function groups_groups_field_default_field_instances() { $field_instances = array(); + // Exported field_instance: 'node-group-field_ambassadors' + $field_instances['node-group-field_ambassadors'] = array( + 'bundle' => 'group', + 'default_value' => NULL, + 'default_value_function' => '', + 'deleted' => 0, + 'description' => '', + 'display' => array( + 'default' => array( + 'label' => 'above', + 'module' => 'entityreference', + 'settings' => array( + 'link' => FALSE, + ), + 'type' => 'entityreference_label', + 'weight' => 20, + ), + 'teaser' => array( + 'label' => 'above', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => 0, + ), + ), + 'entity_type' => 'node', + 'field_name' => 'field_ambassadors', + 'label' => 'Ambassadors', + 'required' => 0, + 'settings' => array( + 'behaviors' => array( + 'prepopulate' => array( + 'status' => 0, + ), + ), + 'user_register_form' => FALSE, + ), + 'widget' => array( + 'active' => 1, + 'module' => 'options', + 'settings' => array(), + 'type' => 'options_buttons', + 'weight' => 50, + ), + ); + // Exported field_instance: 'node-group-field_geofield' $field_instances['node-group-field_geofield'] = array( 'bundle' => 'group', @@ -221,6 +266,7 @@ function groups_groups_field_default_field_instances() { // Translatables // Included for use with string extractors like potx. + t('Ambassadors'); t('Group location'); t('Group status'); t('Resource links'); diff --git a/modules/groups/groups_groups/groups_groups.features.inc b/modules/groups/groups_groups/groups_groups.features.inc new file mode 100644 index 0000000..ecc4217 --- /dev/null +++ b/modules/groups/groups_groups/groups_groups.features.inc @@ -0,0 +1,12 @@ + "3.0"); +} diff --git a/modules/groups/groups_groups/groups_groups.info b/modules/groups/groups_groups/groups_groups.info index 2d5e694..8b030d3 100644 --- a/modules/groups/groups_groups/groups_groups.info +++ b/modules/groups/groups_groups/groups_groups.info @@ -5,6 +5,7 @@ package = groups version = 7.x-1.0 project = groups_groups dependencies[] = commons_groups +dependencies[] = entityreference dependencies[] = features dependencies[] = field_group_location dependencies[] = field_property_list @@ -14,12 +15,16 @@ dependencies[] = groups_common dependencies[] = list dependencies[] = number dependencies[] = options +dependencies[] = views +features[ctools][] = views:views_default:3.0 features[features_api][] = api:2 +features[field_base][] = field_ambassadors features[field_base][] = field_geofield features[field_base][] = field_group_location features[field_base][] = field_group_status features[field_base][] = field_meetup_members features[field_base][] = field_resource_links +features[field_instance][] = node-group-field_ambassadors features[field_instance][] = node-group-field_geofield features[field_instance][] = node-group-field_group_location features[field_instance][] = node-group-field_group_status @@ -27,4 +32,6 @@ features[field_instance][] = node-group-field_meetup_members features[field_instance][] = node-group-field_resource_links features[user_role][] = ambassador features[user_role][] = community_manager -mtime = 1421829172 +features[views_view][] = groups_ambassadors +features_exclude[dependencies][ctools] = ctools +mtime = 1423845401 diff --git a/modules/groups/groups_groups/groups_groups.module b/modules/groups/groups_groups/groups_groups.module index 4aa8176..3f557d9 100644 --- a/modules/groups/groups_groups/groups_groups.module +++ b/modules/groups/groups_groups/groups_groups.module @@ -1,4 +1,10 @@ roles)); + $is_community_mgr = in_array('community_manager', array_values($user->roles)); // hide group status field $form['field_group_status']['#access'] = $is_administrator; // hide location geofield @@ -177,6 +184,8 @@ function groups_groups_form_alter(&$form, &$form_state, $form_id) { $form['field_meetup_members']['#access'] = $is_administrator; // hide group logo $form['field_group_logo']['#access'] = false; + // allow ambassador assignment for admin or community managers + $form['field_ambassadors']['#access'] = $is_community_mgr || $is_administrator; $form['field_group_location']['und'][0]['location']['#title'] = 'City (optional)'; // reorder resource links, group location diff --git a/modules/groups/groups_groups/groups_groups.views_default.inc b/modules/groups/groups_groups/groups_groups.views_default.inc new file mode 100644 index 0000000..5675f4f --- /dev/null +++ b/modules/groups/groups_groups/groups_groups.views_default.inc @@ -0,0 +1,93 @@ +name = 'groups_ambassadors'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'users'; + $view->human_name = 'Groups Ambassadors'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['access']['perm'] = 'access user profiles'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'fields'; + /* Field: User: Name */ + $handler->display->display_options['fields']['name']['id'] = 'name'; + $handler->display->display_options['fields']['name']['table'] = 'users'; + $handler->display->display_options['fields']['name']['field'] = 'name'; + $handler->display->display_options['fields']['name']['label'] = ''; + $handler->display->display_options['fields']['name']['alter']['word_boundary'] = FALSE; + $handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE; + /* Sort criterion: User: Name */ + $handler->display->display_options['sorts']['name']['id'] = 'name'; + $handler->display->display_options['sorts']['name']['table'] = 'users'; + $handler->display->display_options['sorts']['name']['field'] = 'name'; + /* Filter criterion: User: Active */ + $handler->display->display_options['filters']['status']['id'] = 'status'; + $handler->display->display_options['filters']['status']['table'] = 'users'; + $handler->display->display_options['filters']['status']['field'] = 'status'; + $handler->display->display_options['filters']['status']['value'] = '1'; + $handler->display->display_options['filters']['status']['group'] = 1; + $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; + /* Filter criterion: User: Roles */ + $handler->display->display_options['filters']['rid']['id'] = 'rid'; + $handler->display->display_options['filters']['rid']['table'] = 'users_roles'; + $handler->display->display_options['filters']['rid']['field'] = 'rid'; + $handler->display->display_options['filters']['rid']['value'] = array( + 5 => '5', + ); + + /* Display: Entity Reference */ + $handler = $view->new_display('entityreference', 'Entity Reference', 'entityreference_1'); + $handler->display->display_options['defaults']['title'] = FALSE; + $handler->display->display_options['pager']['type'] = 'some'; + $handler->display->display_options['defaults']['style_plugin'] = FALSE; + $handler->display->display_options['style_plugin'] = 'entityreference_style'; + $handler->display->display_options['style_options']['search_fields'] = array( + 'name' => 'name', + ); + $handler->display->display_options['defaults']['style_options'] = FALSE; + $handler->display->display_options['defaults']['row_plugin'] = FALSE; + $handler->display->display_options['row_plugin'] = 'entityreference_fields'; + $handler->display->display_options['defaults']['row_options'] = FALSE; + $translatables['groups_ambassadors'] = array( + t('Master'), + t('more'), + t('Apply'), + t('Reset'), + t('Sort by'), + t('Asc'), + t('Desc'), + t('Items per page'), + t('- All -'), + t('Offset'), + t('« first'), + t('‹ previous'), + t('next ›'), + t('last »'), + t('Entity Reference'), + ); + $export['groups_ambassadors'] = $view; + + return $export; +} diff --git a/modules/groups/groups_pages/groups_pages.info b/modules/groups/groups_pages/groups_pages.info index 9c27ac2..00d2403 100644 --- a/modules/groups/groups_pages/groups_pages.info +++ b/modules/groups/groups_pages/groups_pages.info @@ -16,4 +16,4 @@ features[ctools][] = strongarm:strongarm:1 features[features_api][] = api:2 features[panelizer_defaults][] = node:group:default features[variable][] = panelizer_defaults_node_group -mtime = 1420554875 +mtime = 1423578792 diff --git a/modules/groups/groups_pages/groups_pages.panelizer.inc b/modules/groups/groups_pages/groups_pages.panelizer.inc index e1f0fd3..fa7f61a 100644 --- a/modules/groups/groups_pages/groups_pages.panelizer.inc +++ b/modules/groups/groups_pages/groups_pages.panelizer.inc @@ -210,6 +210,39 @@ function groups_pages_panelizer_defaults() { $display->content['new-89D9A851-8F3A-45BA-AF74-7E55EBF9BB3C'] = $pane; $display->panels['two_66_33_second'][1] = 'new-89D9A851-8F3A-45BA-AF74-7E55EBF9BB3C'; $pane = new stdClass(); + $pane->pid = 'new-95912BBD-5323-4916-B618-6308E1262D31'; + $pane->panel = 'two_66_33_second'; + $pane->type = 'entity_field'; + $pane->subtype = 'node:field_ambassadors'; + $pane->shown = TRUE; + $pane->access = array(); + $pane->configuration = array( + 'label' => 'title', + 'formatter' => 'og_list_default', + 'delta_limit' => '0', + 'delta_offset' => '0', + 'delta_reversed' => 0, + 'formatter_settings' => array( + 'link' => 0, + 'view_mode' => 'default', + 'links' => 1, + ), + 'context' => 'panelizer', + 'override_title' => 1, + 'override_title_text' => 'Ambassadors of this group', + ); + $pane->cache = array(); + $pane->style = array( + 'settings' => NULL, + ); + $pane->css = array(); + $pane->extras = array(); + $pane->position = 2; + $pane->locks = array(); + $pane->uuid = '95912BBD-5323-4916-B618-6308E1262D31'; + $display->content['new-95912BBD-5323-4916-B618-6308E1262D31'] = $pane; + $display->panels['two_66_33_second'][2] = 'new-95912BBD-5323-4916-B618-6308E1262D31'; + $pane = new stdClass(); $pane->pid = 'new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA'; $pane->panel = 'two_66_33_second'; $pane->type = 'views_panes'; @@ -228,11 +261,11 @@ function groups_pages_panelizer_defaults() { ); $pane->css = array(); $pane->extras = array(); - $pane->position = 2; + $pane->position = 3; $pane->locks = array(); $pane->uuid = 'B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA'; $display->content['new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA'] = $pane; - $display->panels['two_66_33_second'][2] = 'new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA'; + $display->panels['two_66_33_second'][3] = 'new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA'; $pane = new stdClass(); $pane->pid = 'new-737D0A90-738F-4637-ABE7-39AF64CC3A1F'; $pane->panel = 'two_66_33_second'; @@ -251,11 +284,11 @@ function groups_pages_panelizer_defaults() { ); $pane->css = array(); $pane->extras = array(); - $pane->position = 3; + $pane->position = 4; $pane->locks = array(); $pane->uuid = '737D0A90-738F-4637-ABE7-39AF64CC3A1F'; $display->content['new-737D0A90-738F-4637-ABE7-39AF64CC3A1F'] = $pane; - $display->panels['two_66_33_second'][3] = 'new-737D0A90-738F-4637-ABE7-39AF64CC3A1F'; + $display->panels['two_66_33_second'][4] = 'new-737D0A90-738F-4637-ABE7-39AF64CC3A1F'; $display->hide_title = PANELS_TITLE_FIXED; $display->title_pane = '0'; $panelizer->display = $display;