Upgrade commons modules to upstream version
Upgrade the commons modules to version 3.15, see release notes here: https://www.drupal.org/node/2292227 The upgrade contains the following custom patches: - 0001-utility-links-block-install-theme.patch Change-Id: Ia3f385d56171d3ea0983fb2c39916dd176e0af6d
@ -9,3 +9,10 @@ dependencies[] = page_manager
|
||||
features[ctools][] = page_manager:pages_default:1
|
||||
features[features_api][] = api:2
|
||||
features[page_manager_pages][] = commons_activity_streams_activity
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -31,7 +31,10 @@ function commons_activity_streams_default_message_type() {
|
||||
"argument_keys" : [],
|
||||
"argument" : [],
|
||||
"category" : "message_type",
|
||||
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
|
||||
"data" : {
|
||||
"token options" : { "clear" : 1 },
|
||||
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
|
||||
},
|
||||
"language" : "",
|
||||
"arguments" : null,
|
||||
"message_text" : { "und" : [
|
||||
@ -60,7 +63,10 @@ function commons_activity_streams_default_message_type() {
|
||||
"argument_keys" : [],
|
||||
"argument" : [],
|
||||
"category" : "message_type",
|
||||
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
|
||||
"data" : {
|
||||
"token options" : { "clear" : 1 },
|
||||
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
|
||||
},
|
||||
"language" : "",
|
||||
"arguments" : null,
|
||||
"message_text" : { "und" : [
|
||||
@ -89,7 +95,10 @@ function commons_activity_streams_default_message_type() {
|
||||
"argument_keys" : [],
|
||||
"argument" : [],
|
||||
"category" : "message_type",
|
||||
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
|
||||
"data" : {
|
||||
"token options" : { "clear" : 1 },
|
||||
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
|
||||
},
|
||||
"language" : "",
|
||||
"arguments" : null,
|
||||
"message_text" : { "und" : [
|
||||
|
@ -37,3 +37,10 @@ features_exclude[field][message-commons_activity_streams_user_profile_updated-fi
|
||||
features_exclude[field_base][field_target_nodes] = field_target_nodes
|
||||
features_exclude[field_base][field_target_comments] = field_target_comments
|
||||
features_exclude[views_view][commons_bw_all] = commons_bw_all
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -109,6 +109,19 @@ function commons_activity_streams_message_access_alter(&$access, $context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Verify view access to comments referenced in the message.
|
||||
if (isset($message->field_target_comments)) {
|
||||
foreach ($message->field_target_comments[LANGUAGE_NONE] as $key => $value) {
|
||||
$comment = comment_load($value['target_id']);
|
||||
if (!entity_access('view', 'comment', $comment, $context['account'])) {
|
||||
// If the user cannot view any comments in the message,
|
||||
// deny access to the entire message;
|
||||
$access = FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,3 +276,35 @@ function commons_activity_streams_tokens($type, $tokens, array $data = array(),
|
||||
}
|
||||
return $replacements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_post_execute().
|
||||
*
|
||||
* Emulate message_access because we don't want the row to appear at all if the
|
||||
* user does not have access to the node or comment. Node access is included in
|
||||
* the view query itself.
|
||||
*
|
||||
* Without this function, the user would see a missing rendered entity, but the
|
||||
* timestamp would still show.
|
||||
*/
|
||||
function commons_activity_streams_views_post_execute(&$view) {
|
||||
if ($view->name == 'commons_activity_streams_activity' && isset($view->result)) {
|
||||
foreach ($view->result AS $key => $msg) {
|
||||
if (isset($msg->mid)) {
|
||||
// We preempt the message_access on render by doing it now. Doesn't make
|
||||
// Two calls because we remove the result if access is false.
|
||||
$message = message_load($msg->mid);
|
||||
if (isset($message->field_target_comments)) {
|
||||
foreach ($message->field_target_comments[LANGUAGE_NONE] as $key => $value) {
|
||||
$comment = comment_load($value['target_id']);
|
||||
if (!entity_access('view', 'comment', $comment)) {
|
||||
// If the user cannot view any nodes or comments in the message,
|
||||
// deny access to the entire message;
|
||||
unset($view->result[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,3 +9,10 @@ dependencies[] = views_content
|
||||
features[ctools][] = views:views_default:3.0
|
||||
features[features_api][] = api:2
|
||||
features[views_view][] = activity_group
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -7,3 +7,10 @@ dependencies[] = field_sql_storage
|
||||
dependencies[] = text
|
||||
features[features_api][] = api:2
|
||||
features[field_base][] = body
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
24
modules/commons/commons_bw/commons_bw.features.inc
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* commons_bw.features.inc
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_plugin_directory().
|
||||
*/
|
||||
function commons_bw_ctools_plugin_directory($module, $plugin) {
|
||||
if ($module == 'ctools' && $plugin == 'content_types') {
|
||||
return 'plugins/' . $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_api().
|
||||
*/
|
||||
function commons_bw_views_api() {
|
||||
return array(
|
||||
'api' => 3,
|
||||
'path' => drupal_get_path('module', 'commons_bw') . '/includes/views',
|
||||
);
|
||||
}
|
@ -11,3 +11,10 @@ features[features_api][] = api:2
|
||||
features[field_base][] = title_field
|
||||
files[] = includes/views/handlers/commons_bw_handler_node_partial_form.inc
|
||||
; Views handlers
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -1,12 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Code for the Commons Browsing Widget feature.
|
||||
*/
|
||||
|
||||
include_once 'commons_bw.features.inc';
|
||||
|
||||
/**
|
||||
* Implements hook_hook_info().
|
||||
*/
|
||||
function commons_bw_hook_info() {
|
||||
$hooks = array(
|
||||
'commons_bw_group_widget',
|
||||
'commons_bw_create_all_widget',
|
||||
);
|
||||
|
||||
return array_fill_keys($hooks, array('group' => 'commons'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_system_info_alter().
|
||||
*/
|
||||
function commons_bw_system_info_alter(&$info, $file, $type) {
|
||||
// Commons BW dynamically adds the title_field field to content types that
|
||||
// request it.
|
||||
// We must add a corresponding line for each field instance to commons_bw.info
|
||||
// so that Features is aware of the instance and can successfully revert the
|
||||
// field_instance component back to its default state.
|
||||
if ($file->name == 'commons_bw') {
|
||||
foreach (node_type_get_types() as $node_type) {
|
||||
$type = $node_type->type;
|
||||
|
||||
if (commons_bw_node_auto_title_instance($type)) {
|
||||
$info['features']['field_instance'][] = "node-$type-title_field";
|
||||
}
|
||||
@ -14,40 +38,6 @@ function commons_bw_system_info_alter(&$info, $file, $type) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_plugin_directory().
|
||||
*/
|
||||
function commons_bw_ctools_plugin_directory($module, $plugin) {
|
||||
if ($module == 'ctools' && $plugin == 'content_types') {
|
||||
return 'plugins/' . $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_api().
|
||||
*/
|
||||
function commons_bw_views_api() {
|
||||
return array(
|
||||
'api' => 3,
|
||||
'path' => drupal_get_path('module', 'commons_bw') . '/includes/views',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_alter().
|
||||
*/
|
||||
function commons_bw_form_alter(&$form, &$form_state, $form_id) {
|
||||
// Implements tweaks to exposed filters and sorts per the Commons designs.
|
||||
if ($form_id != 'views_exposed_form' || strpos($form['#id'],'views-exposed-form-commons-bw') !== 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the sort order (eg, descending vs ascending).
|
||||
$form['sort_order']['#access'] = FALSE;
|
||||
|
||||
$form['sort_by']['#title'] = t('Sorted by');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_forms().
|
||||
*
|
||||
@ -56,6 +46,7 @@ function commons_bw_form_alter(&$form, &$form_state, $form_id) {
|
||||
*/
|
||||
function commons_bw_forms($form_id, $args) {
|
||||
$forms = array();
|
||||
|
||||
if (strpos($form_id, 'commons_bw_partial_node_form__') === 0) {
|
||||
$forms[$form_id] = array(
|
||||
'callback' => 'commons_bw_partial_node_form',
|
||||
@ -66,10 +57,50 @@ function commons_bw_forms($form_id, $args) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Partial node form for the browsing widget.
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function commons_bw_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
|
||||
// Implements tweaks to exposed filters and sorts per the Commons designs.
|
||||
if (strpos($form['#id'],'views-exposed-form-commons-bw') === 0) {
|
||||
// Remove the sort order (eg, descending vs ascending).
|
||||
$form['sort_order']['#access'] = FALSE;
|
||||
$form['sort_by']['#title'] = t('Sorted by');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*
|
||||
* @param $bundle
|
||||
* The node bundle.
|
||||
* Add a setting to group content fields, to determine whether they will be
|
||||
* displayed on the mini node form of the browsing widget.
|
||||
*/
|
||||
function commons_bw_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
|
||||
if (!og_is_group_content_type($form['instance']['entity_type']['#value'], $form['instance']['bundle']['#value'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// See if we're building for the first time, or getting pre-saved values.
|
||||
$field_name = $form['#field']['field_name'];
|
||||
|
||||
if(!empty($form_state['field'][$field_name][LANGUAGE_NONE]['instance']['display_in_partial_form'])) {
|
||||
$display_default = $form_state['field'][$field_name][LANGUAGE_NONE]['instance']['display_in_partial_form'];
|
||||
}
|
||||
else if (isset($form_state['build_info']['args'][0]['display_in_partial_form'])) {
|
||||
$display_default = $form_state['build_info']['args'][0]['display_in_partial_form'];
|
||||
}
|
||||
else {
|
||||
$display_default = FALSE;
|
||||
}
|
||||
|
||||
$form['instance']['display_in_partial_form'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Display in the browsing widget mini-form'),
|
||||
'#default_value' => $display_default,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Partial node form for the browsing widget.
|
||||
*/
|
||||
function commons_bw_partial_node_form($form, &$form_state, $bundle, $group_id = NULL) {
|
||||
global $user;
|
||||
@ -95,6 +126,7 @@ function commons_bw_partial_node_form($form, &$form_state, $bundle, $group_id =
|
||||
unset($instances[$field_name]);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure there's a field left to display.
|
||||
if (empty($instances)) {
|
||||
return $form;
|
||||
@ -134,10 +166,9 @@ function commons_bw_partial_node_form($form, &$form_state, $bundle, $group_id =
|
||||
$form[OG_AUDIENCE_FIELD]['#weight'] = 100;
|
||||
$form[OG_AUDIENCE_FIELD]['#access'] = !$group_id;
|
||||
|
||||
// Form title.
|
||||
$bundles = field_info_bundles('node');
|
||||
// Add a default form title.
|
||||
$form['title'] = array(
|
||||
'#markup' => '<h3>' . t('Create a @bundle', array('@bundle' => strtolower($bundles[$bundle]['label']))) . '</h3>',
|
||||
'#markup' => t('Create content'),
|
||||
'#weight' => -50,
|
||||
);
|
||||
|
||||
@ -162,6 +193,14 @@ function commons_bw_partial_node_form($form, &$form_state, $bundle, $group_id =
|
||||
'#value' => t('Save'),
|
||||
);
|
||||
|
||||
// Attach the browsing widget JS and give it a higher weight than
|
||||
// quicktabs.js.
|
||||
$form['#attached']['js'][] = array(
|
||||
'data' => drupal_get_path('module', 'commons_bw') . '/js/partial_node_form.js',
|
||||
'type' => 'file',
|
||||
'weight' => 100,
|
||||
);
|
||||
|
||||
// Add in some descriptive classes for css down the line.
|
||||
$form['#attributes']['class'][] = 'node';
|
||||
$form['#attributes']['class'][] = 'commons-bw-partial-node-form';
|
||||
@ -187,6 +226,7 @@ function commons_bw_partial_node_form($form, &$form_state, $bundle, $group_id =
|
||||
// to address fields by there CSS ID.
|
||||
array_unshift($form['#pre_render'], 'commons_bw_partial_node_form_after_build');
|
||||
$form['#validate'][] = 'commons_bw_partial_node_form_validate';
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
@ -195,6 +235,7 @@ function commons_bw_partial_node_form($form, &$form_state, $bundle, $group_id =
|
||||
*/
|
||||
function commons_bw_partial_node_form_after_build($form) {
|
||||
$bundle = $form['#bundle'];
|
||||
|
||||
// Add the node's bundle to the IDs of inputs, to avoid having duplicate IDs.
|
||||
$id_suffix = '-' . str_replace('_', '-', $bundle);
|
||||
|
||||
@ -214,12 +255,14 @@ function commons_bw_partial_node_form_after_build($form) {
|
||||
|
||||
// Set the form action to the form's tab.
|
||||
$tabs = commons_bw_get_tab_definitions();
|
||||
|
||||
// Search for the tab displaying the current bundle.
|
||||
foreach ($tabs as $tab_id => $settings) {
|
||||
if ($settings['bundle'] == $bundle) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$form['#action'] = url(current_path(), array('query' => array('qt-commons_bw' => $tab_id)));
|
||||
|
||||
return $form;
|
||||
@ -230,8 +273,10 @@ function commons_bw_partial_node_form_after_build($form) {
|
||||
*/
|
||||
function commons_bw_partial_node_form_validate($form, $form_state) {
|
||||
$node = $form['#entity'];
|
||||
|
||||
field_attach_validate('node', $node);
|
||||
node_validate($node, $form, $form_state);
|
||||
|
||||
if ((!module_exists('commons_trusted_contacts') || (module_exists('commons_trusted_contacts') && !module_exists('og_access'))) && empty($form_state['group_id']) && empty($form_state['values'][OG_AUDIENCE_FIELD][LANGUAGE_NONE][0])) {
|
||||
form_set_error(OG_AUDIENCE_FIELD, t('Please enter one or more groups where this content will be posted.'));
|
||||
return FALSE;
|
||||
@ -243,7 +288,9 @@ function commons_bw_partial_node_form_validate($form, $form_state) {
|
||||
*/
|
||||
function commons_bw_partial_node_form_submit($form, $form_state) {
|
||||
$node = $form['#entity'];
|
||||
|
||||
node_submit($node);
|
||||
|
||||
// Mark the node as created with the partial form
|
||||
$node->partial_node_form = TRUE;
|
||||
field_attach_submit('node', $node, $form, $form_state);
|
||||
@ -255,8 +302,10 @@ function commons_bw_partial_node_form_submit($form, $form_state) {
|
||||
if ((empty($wrapper->title_field) || !$wrapper->title_field->value()) && empty($node->title)) {
|
||||
if (!empty($wrapper->body) && $wrapper->body->value()) {
|
||||
$title = htmlspecialchars_decode($wrapper->body->value->value());
|
||||
|
||||
// Strip tags and whitespaces.
|
||||
$title = preg_replace('/[\t\n\r\0\x0B]/', '', strip_tags($title));
|
||||
|
||||
// Shorten the title.
|
||||
$node->title = truncate_utf8($title, 30, TRUE, TRUE);
|
||||
}
|
||||
@ -273,120 +322,139 @@ function commons_bw_partial_node_form_submit($form, $form_state) {
|
||||
|
||||
// Notify about the node creation.
|
||||
$arguments = array('@type' => node_type_get_name($node), '%title' => $node->title);
|
||||
|
||||
drupal_set_message(t('@type %title has been created.', $arguments));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
* Get a list of modules that add content to a particular type of widget.
|
||||
*
|
||||
* Add a setting to group content fields, to determine whether they will be
|
||||
* displayed on the mini node form of the browsing widget.
|
||||
* The only currently supported widget type is 'group', but this
|
||||
* could be extended to support other entities.
|
||||
*
|
||||
* @param $widget_type
|
||||
* An optional type of widget to restrict results to, defaults to 'group'.
|
||||
*
|
||||
* @return array
|
||||
* An array of return values of the hook implementations.
|
||||
*/
|
||||
function commons_bw_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
|
||||
if (!og_is_group_content_type($form['instance']['entity_type']['#value'], $form['instance']['bundle']['#value'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
// See if we're building for the first time, or getting pre-saved values.
|
||||
$field_name = $form['#field']['field_name'];
|
||||
if(!empty($form_state['field'][$field_name][LANGUAGE_NONE]['instance']['display_in_partial_form'])) {
|
||||
$display_default = $form_state['field'][$field_name][LANGUAGE_NONE]['instance']['display_in_partial_form'];
|
||||
}
|
||||
else if (isset($form_state['build_info']['args'][0]['display_in_partial_form'])) {
|
||||
$display_default = $form_state['build_info']['args'][0]['display_in_partial_form'];
|
||||
}
|
||||
else {
|
||||
$display_default = FALSE;
|
||||
}
|
||||
|
||||
$form['instance']['display_in_partial_form'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Display in the browsing widget mini-form'),
|
||||
'#default_value' => $display_default,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of modules that add content to a particular type of widget.
|
||||
* The only currently supported widget type is 'group', but this
|
||||
* could be extended to support other entities.
|
||||
*/
|
||||
function commons_bw_get_tab_definitions($widget_type = 'group') {
|
||||
$hook_name = 'commons_bw_' . $widget_type . '_widget';
|
||||
|
||||
$tabs = module_invoke_all($hook_name);
|
||||
|
||||
drupal_alter($hook_name, $tabs);
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper function to determine whether Commons_BW should define a title
|
||||
* field instance on behalf of a content type.
|
||||
* Helper function to determine whether Commons_BW should define a title field
|
||||
* instance on behalf of a content type.
|
||||
*
|
||||
* @param $node_type
|
||||
* The type of the node to check auto title settings for.
|
||||
*
|
||||
* @return boolean
|
||||
* The value of the auto title setting if available, TRUE otherwise.
|
||||
*/
|
||||
function commons_bw_node_auto_title_instance($node_type) {
|
||||
$commons_groups_entity_types = commons_groups_get_group_content_entity_types();
|
||||
$return = isset($commons_groups_entity_types['node'][$node_type]['auto_title_instance']) ? $commons_groups_entity_types['node'][$node_type]['auto_title_instance'] : TRUE;
|
||||
return $return;
|
||||
|
||||
return isset($commons_groups_entity_types['node'][$node_type]['auto_title_instance']) ? $commons_groups_entity_types['node'][$node_type]['auto_title_instance'] : TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a styled content creation dropdown widget for the 'all'
|
||||
* tab of the group homepage browsing widget.
|
||||
* Provides a styled content creation dropdown widget for the 'all' tab of the
|
||||
* group homepage browsing widget.
|
||||
*
|
||||
* @param $group
|
||||
* The group node associated with the group homepage.
|
||||
*
|
||||
* @return string
|
||||
* The content creation dropdown widget HTML.
|
||||
*/
|
||||
function commons_bw_create_all_widget($group) {
|
||||
$links = array();
|
||||
|
||||
// Collect definitions from implementing modules.
|
||||
$items = module_invoke_all('commons_bw_create_all_widget', $group);
|
||||
uasort($items, 'element_sort');
|
||||
|
||||
foreach ($items as $module => $item) {
|
||||
$links[] = $item['link'] . ' ' . $item['text'];
|
||||
|
||||
// Populate the default content creation link.
|
||||
if (isset($item['default']) && $item['default']) {
|
||||
$default = $item;
|
||||
}
|
||||
}
|
||||
|
||||
$output = '';
|
||||
|
||||
if (!empty($default)) {
|
||||
$output .= $default['link'] . '<a class="commons-bw-create-choose"><span></span></a>';
|
||||
}
|
||||
|
||||
$output .= '<div class="commons-bw-create-choose-bg"></div><div class="commons-bw-create-choose-holder">' . theme('item_list', array('items' => $links, 'type' => 'ul', 'attributes' => array('class' => 'commons-bw-create-all-widget-types'))) . '</div>';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a renderable group widget.
|
||||
*
|
||||
* @param $group
|
||||
* An optional group node to be used as a tab and views argument.
|
||||
*
|
||||
* @return array
|
||||
* An array in the format expected by drupal_render().
|
||||
*/
|
||||
function commons_bw_generate_group_widget($group = NULL) {
|
||||
// The partial_node_form.js should be after quicktabs.js.
|
||||
drupal_add_js(drupal_get_path('module', 'commons_bw') . '/js/partial_node_form.js', array('weight' => 100));
|
||||
// Prepare an array of default quicktabs settings.
|
||||
$settings = array(
|
||||
'style' => 'Commons Pills',
|
||||
'ajax' => FALSE,
|
||||
'html' => TRUE,
|
||||
);
|
||||
|
||||
$settings = array('style' => 'Commons Pills', 'ajax' => FALSE, 'html' => TRUE);
|
||||
// Load the default tab definitions.
|
||||
// Load the browsing widget tab definitions.
|
||||
$tabs = commons_bw_get_tab_definitions('group');
|
||||
foreach ($tabs as $key => $tab) {
|
||||
// Populate the group argument.
|
||||
$tabs[$key]['args'] = $group ? $group->nid : 0;
|
||||
|
||||
// Add the result count for Tabs that are of the type 'view';
|
||||
if ($tab['type'] == 'view') {
|
||||
$view = views_get_view($tab['vid']);
|
||||
if (isset($tab['display'])) {
|
||||
$view->set_display($tab['display']);
|
||||
foreach ($tabs as $machine_name => $tab_settings) {
|
||||
// Populate the group argument.
|
||||
$tabs[$machine_name]['args'] = $group ? $group->nid : 0;
|
||||
|
||||
// Add the result count to the title for 'view' tabs.
|
||||
if ($tab_settings['type'] == 'view') {
|
||||
// Get the view specified by the tab settings.
|
||||
$view = views_get_view($tab_settings['vid']);
|
||||
|
||||
// If the tab specified a view display use it, otherwise the view will be
|
||||
// rendered using the default display.
|
||||
if (isset($tab_settings['display'])) {
|
||||
$view->set_display($tab_settings['display']);
|
||||
}
|
||||
|
||||
// If the tab references a group, set it as a tab argument.
|
||||
if ($group) {
|
||||
$view->set_arguments(array($group->nid));
|
||||
}
|
||||
|
||||
$view->display_handler->options['filters']['flagged']['value'] = 'All';
|
||||
$view->get_total_rows = TRUE;
|
||||
$view->execute();
|
||||
$tabs[$key]['title'] = $tabs[$key]['title'] . ' <span class="commons-bw-result-count">'. $view->total_rows . '</span>';
|
||||
|
||||
// Append the result count to the tab title.
|
||||
$tabs[$machine_name]['title'] = $tabs[$machine_name]['title'] . ' <span class="commons-bw-result-count">'. $view->total_rows . '</span>';
|
||||
}
|
||||
// Set the default tab.
|
||||
if (isset($tabs[$key]['default']) && $tabs[$key]['default']) {
|
||||
$settings['default_tab'] = $key;
|
||||
|
||||
// Use the current tab as the quicktabs default if the tab settings specify.
|
||||
if (!empty($tabs[$machine_name]['default'])) {
|
||||
$settings['default_tab'] = $machine_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the Quicktabs instance.
|
||||
return quicktabs_build_quicktabs('commons_bw', $settings, $tabs);
|
||||
}
|
||||
|
||||
@ -395,6 +463,7 @@ function commons_bw_generate_group_widget($group = NULL) {
|
||||
*/
|
||||
function commons_bw_quicktabs_tabstyles() {
|
||||
$path = drupal_get_path('module', 'commons_bw');
|
||||
|
||||
return array(
|
||||
$path . '/plugins/quicktabs_styles/commons_pills/commons_pills.css' => t('Commons Pills'),
|
||||
$path . '/plugins/quicktabs_styles/commons_tabs/commons_tabs.css' => t('Commons Tabs'),
|
||||
|
@ -12,7 +12,7 @@ $plugin = array(
|
||||
'content type' => 'commons_bw_group',
|
||||
'all contexts' => TRUE,
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Output function for the '[content_type]' content type.
|
||||
*/
|
||||
@ -26,14 +26,14 @@ function commons_bw_commons_bw_group_content_type_render($subtype, $conf, $panel
|
||||
$block->content = drupal_render($widget['content']);
|
||||
return $block;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an edit form for the custom type.
|
||||
*/
|
||||
function commons_bw_commons_bw_group_content_type_edit_form($form, $form_state) {
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an edit form for the custom type.
|
||||
*/
|
||||
|
@ -12,10 +12,8 @@
|
||||
}
|
||||
.quicktabs-style-commons-pills ul.quicktabs-tabs li a {
|
||||
background-color: #f1f1f1;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-ms-border-radius: 3px;
|
||||
-o-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
padding: 3px 10px 3px 6px;
|
||||
display: block;
|
||||
@ -52,7 +50,7 @@
|
||||
|
||||
#quicktabs-tab-commons_bw-commons_all:before {
|
||||
content: '';
|
||||
background: url('images/icons-s2238b17da1.png') 0 -99px no-repeat;
|
||||
background: url('images/icons-saf2440b105.png') 0 -31px no-repeat;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
display: inline-block;
|
||||
@ -61,12 +59,12 @@
|
||||
top: 1px;
|
||||
}
|
||||
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_all:before {
|
||||
background-position: 0 -163px;
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
#quicktabs-tab-commons_bw-commons_posts:before {
|
||||
content: '';
|
||||
background: url('images/icons-s2238b17da1.png') 0 -322px no-repeat;
|
||||
background: url('images/icons-saf2440b105.png') 0 -285px no-repeat;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
display: inline-block;
|
||||
@ -75,12 +73,12 @@ ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_all
|
||||
top: 1px;
|
||||
}
|
||||
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_posts:before {
|
||||
background-position: 0 -353px;
|
||||
background-position: 0 -254px;
|
||||
}
|
||||
|
||||
#quicktabs-tab-commons_bw-commons_documents:before {
|
||||
content: '';
|
||||
background: url('images/icons-s2238b17da1.png') 0 -384px no-repeat;
|
||||
background: url('images/icons-saf2440b105.png') 0 -94px no-repeat;
|
||||
width: 9px;
|
||||
height: 12px;
|
||||
display: inline-block;
|
||||
@ -89,12 +87,12 @@ ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_pos
|
||||
top: 1px;
|
||||
}
|
||||
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_documents:before {
|
||||
background-position: 0 -416px;
|
||||
background-position: 0 -62px;
|
||||
}
|
||||
|
||||
#quicktabs-tab-commons_bw-commons_q_a:before {
|
||||
content: '';
|
||||
background: url('images/icons-s2238b17da1.png') 0 -66px no-repeat;
|
||||
background: url('images/icons-saf2440b105.png') 0 -349px no-repeat;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
display: inline-block;
|
||||
@ -103,12 +101,12 @@ ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_doc
|
||||
top: 1px;
|
||||
}
|
||||
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_q_a:before {
|
||||
background-position: 0 -130px;
|
||||
background-position: 0 -316px;
|
||||
}
|
||||
|
||||
#quicktabs-tab-commons_bw-commons_ideas:before {
|
||||
content: '';
|
||||
background: url('images/icons-s2238b17da1.png') 0 -225px no-repeat;
|
||||
background: url('images/icons-saf2440b105.png') 0 -159px no-repeat;
|
||||
width: 8px;
|
||||
height: 13px;
|
||||
display: inline-block;
|
||||
@ -117,12 +115,12 @@ ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_q_a
|
||||
top: 1px;
|
||||
}
|
||||
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_ideas:before {
|
||||
background-position: 0 -289px;
|
||||
background-position: 0 -126px;
|
||||
}
|
||||
|
||||
#quicktabs-tab-commons_bw-commons_wikis:before {
|
||||
content: '';
|
||||
background: url('images/icons-s2238b17da1.png') 0 0 no-repeat;
|
||||
background: url('images/icons-saf2440b105.png') 0 -415px no-repeat;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
display: inline-block;
|
||||
@ -131,12 +129,12 @@ ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_ide
|
||||
top: 1px;
|
||||
}
|
||||
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_wikis:before {
|
||||
background-position: 0 -33px;
|
||||
background-position: 0 -382px;
|
||||
}
|
||||
|
||||
#quicktabs-tab-commons_bw-commons_polls:before {
|
||||
content: '';
|
||||
background: url('images/icons-s2238b17da1.png') 0 -194px no-repeat;
|
||||
background: url('images/icons-saf2440b105.png') 0 -223px no-repeat;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
display: inline-block;
|
||||
@ -145,5 +143,5 @@ ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_wik
|
||||
top: 1px;
|
||||
}
|
||||
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_polls:before {
|
||||
background-position: 0 -258px;
|
||||
background-position: 0 -192px;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 409 B After Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 115 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 190 B |
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 213 B |
Before Width: | Height: | Size: 422 B After Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 476 B After Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 494 B After Width: | Height: | Size: 321 B |
@ -17,3 +17,10 @@ features[variable][] = flag_abuse_flags
|
||||
features[views_view][] = commons_content_moderation_reported_comments
|
||||
features[views_view][] = commons_content_moderation_reported_nodes
|
||||
features_exclude[dependencies][features] = features
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -17,3 +17,34 @@ function commons_content_moderation_update_7001() {
|
||||
function commons_content_moderation_update_7002() {
|
||||
cache_clear_all('*', 'cache_views', TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the title attribute with the title field in view displays.
|
||||
*/
|
||||
function commons_content_moderation_update_7003() {
|
||||
$revert = array(
|
||||
'commons_content_moderation' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete any copies of the Flag Abuse default flags stored in the database in
|
||||
* order to allow alterations to take effect.
|
||||
*/
|
||||
function commons_content_moderation_update_7004() {
|
||||
// The Flag module automatically copies module-provided default flags into the
|
||||
// database for performance reasons.
|
||||
// Delete the Flag Abuse default flags from the database in order to have the
|
||||
// default flag alterations take effect.
|
||||
foreach (array('abuse_user', 'abuse_comment', 'abuse_node', 'abuse_whitelist_comment', 'abuse_whitelist_node', 'abuse_whitelist_user') as $abuse_flag) {
|
||||
$flag = flag_get_flag($abuse_flag);
|
||||
|
||||
if($flag) {
|
||||
$flag->delete();
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
@ -94,6 +94,19 @@ function commons_content_moderation_delete_comment_block_user($comment, $context
|
||||
watchdog('commons_content_moderation', 'Deleted comment %title.', array('%title' => $comment->title));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_flag_default_flags_alter().
|
||||
*/
|
||||
function commons_content_moderation_flag_default_flags_alter(&$flags) {
|
||||
// Disable default node and comment abuse flags in favor of Commons-specific
|
||||
// flags included with Commons Content Moderation.
|
||||
foreach (array('abuse_user', 'abuse_comment', 'abuse_node', 'abuse_whitelist_comment', 'abuse_whitelist_node', 'abuse_whitelist_user') as $flag_name) {
|
||||
if (!empty($flags[$flag_name])) {
|
||||
$flags[$flag_name]['status'] = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_default_views_alter().
|
||||
*/
|
||||
@ -113,7 +126,7 @@ function commons_content_moderation_views_default_views_alter(&$views) {
|
||||
function commons_content_moderation_views_pre_build(&$view) {
|
||||
// Disable bulk content moderation operations if the user does not have
|
||||
// appropriate access.
|
||||
if ($view->name == 'commons_content_moderation_reported_nodes' && !module_exists('actions_permissions') && (!user_access('administer content') || !user_access('administer users'))) {
|
||||
if ($view->name == 'commons_content_moderation_reported_nodes' && !module_exists('actions_permissions') && (!user_access('administer nodes') || !user_access('administer users'))) {
|
||||
unset($view->field['views_bulk_operations']);
|
||||
unset($view->display_handler->handlers['field']['views_bulk_operations']);
|
||||
}
|
||||
|
@ -228,11 +228,12 @@ function commons_content_moderation_views_default_views() {
|
||||
$handler->display->display_options['fields']['subject']['table'] = 'comment';
|
||||
$handler->display->display_options['fields']['subject']['field'] = 'subject';
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['relationship'] = 'nid';
|
||||
$handler->display->display_options['fields']['title']['label'] = 'Comment on';
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['relationship'] = 'nid';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = 'Comment on';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: Comment: Author */
|
||||
$handler->display->display_options['fields']['name_2']['id'] = 'name_2';
|
||||
$handler->display->display_options['fields']['name_2']['table'] = 'comment';
|
||||
@ -553,9 +554,10 @@ function commons_content_moderation_views_default_views() {
|
||||
$handler->display->display_options['fields']['type']['field'] = 'type';
|
||||
$handler->display->display_options['fields']['type']['exclude'] = TRUE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: Flags: Flag counter */
|
||||
$handler->display->display_options['fields']['count']['id'] = 'count';
|
||||
$handler->display->display_options['fields']['count']['table'] = 'flag_counts';
|
||||
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Commons module integration for the Commons Documents module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_commons_entity_integration().
|
||||
*/
|
||||
function commons_documents_commons_entity_integration() {
|
||||
return array(
|
||||
'node' => array(
|
||||
'document' => array(
|
||||
'is_group_content' => TRUE,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_commons_bw_group_widget().
|
||||
*/
|
||||
function commons_documents_commons_bw_group_widget() {
|
||||
return array(
|
||||
'commons_documents' => array(
|
||||
'title' => t('Docs'),
|
||||
'type' => 'view',
|
||||
'vid' => 'commons_bw_documents',
|
||||
'display' => 'default',
|
||||
'weight' => 6,
|
||||
'bundle' => 'document',
|
||||
),
|
||||
);
|
||||
}
|
@ -44,3 +44,10 @@ features[variable][] = node_options_document
|
||||
features[variable][] = node_preview_document
|
||||
features[variable][] = node_submitted_document
|
||||
features[views_view][] = commons_bw_documents
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -1,5 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Set default document roles upon enable
|
||||
*/
|
||||
function commons_documents_enable() {
|
||||
features_revert(array('commons_documents' => array('og_features_permission', 'field_instance', 'field_base', 'variable', 'views_view', 'node')));
|
||||
|
||||
$groups = og_get_all_group();
|
||||
|
||||
foreach ($groups as $gid) {
|
||||
commons_groups_features_permission_rebuild('commons_documents', $gid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable summary on Document nodes.
|
||||
*/
|
||||
@ -87,3 +100,31 @@ function commons_documents_update_7007() {
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
/**
|
||||
* Replace the title attribute with the title field in view displays.
|
||||
*/
|
||||
function commons_documents_update_7008() {
|
||||
$revert = array(
|
||||
'commons_documents' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset document og permissions automatically, they were not set before now.
|
||||
*/
|
||||
function commons_documents_update_7009() {
|
||||
$revert = array(
|
||||
'commons_documents' => array('og_features_permission'),
|
||||
);
|
||||
features_revert($revert);
|
||||
|
||||
$groups = og_get_all_group();
|
||||
|
||||
foreach ($groups AS $gid) {
|
||||
commons_groups_features_permission_rebuild('commons_documents', $gid);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
@ -7,32 +7,16 @@
|
||||
include_once 'commons_documents.features.inc';
|
||||
|
||||
/**
|
||||
* Implements hook_commons_entity_integration().
|
||||
* Implements hook_form_BASE_FORM_ID_alter().
|
||||
*/
|
||||
function commons_documents_commons_entity_integration() {
|
||||
return array(
|
||||
'node' => array(
|
||||
'document' => array(
|
||||
'is_group_content' => TRUE,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
function commons_documents_form_node_form_alter(&$form, &$form_state, $form_id) {
|
||||
$node = $form['#node'];
|
||||
|
||||
/**
|
||||
* Implements hook_commons_bw_group_widget().
|
||||
*/
|
||||
function commons_documents_commons_bw_group_widget() {
|
||||
return array(
|
||||
'commons_documents' => array(
|
||||
'title' => t('Docs'),
|
||||
'type' => 'view',
|
||||
'vid' => 'commons_bw_documents',
|
||||
'display' => 'default',
|
||||
'weight' => 6,
|
||||
'bundle' => 'document',
|
||||
),
|
||||
);
|
||||
list(, , $bundle) = entity_extract_ids('node', $node);
|
||||
|
||||
if ($bundle == 'document' && empty($node->nid)) {
|
||||
drupal_set_title(t('Create a document'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -43,6 +27,8 @@ function commons_documents_form_commons_bw_partial_node_form_alter(&$form, &$for
|
||||
return;
|
||||
}
|
||||
|
||||
$form['title']['#markup'] = t('Create a document');
|
||||
|
||||
$language = $form['body']['#language'];
|
||||
$form['body'][$language][0]['#title_display'] = 'invisible';
|
||||
$form['body'][$language][0]['#required'] = TRUE;
|
||||
@ -73,17 +59,6 @@ function commons_documents_form_commons_bw_partial_node_form_after_build($form)
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_default_views_alter().
|
||||
*
|
||||
* Display documents on the browsing widget main view.
|
||||
*/
|
||||
function commons_documents_views_default_views_alter(&$views) {
|
||||
if (!empty($views['commons_bw_all'])) {
|
||||
$views['commons_bw_all']->display['default']->display_options['filters']['type']['value']['document'] = 'document';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_pre_render().
|
||||
*/
|
||||
|
@ -54,12 +54,11 @@ function commons_documents_views_default_views() {
|
||||
$handler->display->display_options['relationships']['og_membership_rel']['field'] = 'og_membership_rel';
|
||||
$handler->display->display_options['relationships']['og_membership_rel']['required'] = TRUE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Sort criterion: Content: Sticky */
|
||||
$handler->display->display_options['sorts']['sticky']['id'] = 'sticky';
|
||||
$handler->display->display_options['sorts']['sticky']['table'] = 'node';
|
||||
@ -133,3 +132,14 @@ function commons_documents_views_default_views() {
|
||||
|
||||
return $export;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_default_views_alter().
|
||||
*
|
||||
* Display documents on the browsing widget main view.
|
||||
*/
|
||||
function commons_documents_views_default_views_alter(&$views) {
|
||||
if (!empty($views['commons_bw_all'])) {
|
||||
$views['commons_bw_all']->display['default']->display_options['filters']['type']['value']['document'] = 'document';
|
||||
}
|
||||
}
|
||||
|
40
modules/commons/commons_events/commons_events.commons.inc
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Commons module integration for the Commons Events module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_commons_entity_integration().
|
||||
*/
|
||||
function commons_events_commons_entity_integration() {
|
||||
return array(
|
||||
'node' => array(
|
||||
'event' => array(
|
||||
'is_group_content' => TRUE,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_commons_bw_create_all_widget().
|
||||
*/
|
||||
function commons_events_commons_bw_create_all_widget($group) {
|
||||
if (og_user_access('node', $group->nid, 'create event content')) {
|
||||
$link = l(t('List an event'), 'node/add/event',
|
||||
array(
|
||||
'attributes' => array('class' => 'commons-events-create'),
|
||||
'query' => array('og_group_ref' => $group->nid),
|
||||
)
|
||||
);
|
||||
|
||||
return array(
|
||||
'commons_events' => array(
|
||||
'link' => $link,
|
||||
'text' => t('Create in-person or online meetups'),
|
||||
'#weight' => 6,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -154,7 +154,7 @@ function commons_events_default_message_type() {
|
||||
"argument" : [],
|
||||
"category" : "commons_notify",
|
||||
"data" : {
|
||||
"token options" : { "clear" : 0 },
|
||||
"token options" : { "clear" : 1 },
|
||||
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
|
||||
},
|
||||
"language" : "",
|
||||
|
@ -104,3 +104,10 @@ files[] = commons_events.features.field_instance.inc
|
||||
files[] = commons_events.strongarm.inc
|
||||
files[] = includes/commons_events.forms.inc
|
||||
files[] = includes/commons_events.theme.inc
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -1,5 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Set default events roles upon enable
|
||||
*/
|
||||
function commons_events_enable() {
|
||||
$revert = array(
|
||||
'commons_events' => array('og_features_permission'),
|
||||
);
|
||||
features_revert($revert);
|
||||
|
||||
$groups = og_get_all_group();
|
||||
|
||||
foreach ($groups AS $gid) {
|
||||
commons_groups_features_permission_rebuild('commons_events', $gid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_install().
|
||||
* Creates a default datetime format for events.
|
||||
@ -233,4 +249,26 @@ function commons_events_update_7012() {
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort and filter the upcoming user events view by start date.
|
||||
*/
|
||||
function commons_events_update_7013() {
|
||||
$revert = array(
|
||||
'commons_events' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the title attribute with the title field in view displays.
|
||||
*/
|
||||
function commons_events_update_7014() {
|
||||
$revert = array(
|
||||
'commons_events' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
@ -23,6 +23,22 @@ function commons_events_forms($form_id, $args) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function commons_events_menu() {
|
||||
$items['node/%node/attendees'] = array(
|
||||
'title' => 'Attendees',
|
||||
'page callback' => 'commons_events_event_attendees_page',
|
||||
'page arguments' => array(1),
|
||||
'access callback' => 'commons_events_attendee_access',
|
||||
'access arguments' => array(1),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_menu_alter().
|
||||
*/
|
||||
@ -38,6 +54,7 @@ function commons_events_attendee_access($event_node) {
|
||||
if ($event_node->type == 'event') {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -175,6 +192,7 @@ function commons_events_date_popup_element_process($element, &$form_state, $form
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
@ -182,22 +200,30 @@ function commons_events_date_popup_element_process($element, &$form_state, $form
|
||||
* Implements hook_entity_view_alter().
|
||||
*/
|
||||
function commons_events_entity_view_alter(&$build, $type) {
|
||||
if ($build['#entity_type'] == 'node' && $build['#bundle'] == 'event') {
|
||||
if ($type == 'node' && isset($build['#node'])) {
|
||||
$node = $build['#node'];
|
||||
|
||||
$build['attending'] = array(
|
||||
0 => theme('commons_events_attending_event', array(
|
||||
'event' => $build['#node'],
|
||||
'attendee_count' => commons_events_get_raw_attendee_count($build['#node']),
|
||||
list(, , $bundle) = entity_extract_ids('node', $node);
|
||||
|
||||
if ($bundle == 'event') {
|
||||
$build['attending'] = array(
|
||||
0 => theme('commons_events_attending_event', array(
|
||||
'event' => $node,
|
||||
'attendee_count' => commons_events_get_raw_attendee_count($node),
|
||||
)),
|
||||
'#weight' => -10,
|
||||
);
|
||||
$vars = array(
|
||||
'event_nid' => $build['#node']->nid,
|
||||
);
|
||||
// Don't show the address if the event location is only online.
|
||||
$field_location = field_view_field('node', $build['#node'], 'field_location');
|
||||
if (isset($field_location['#items']['0']['value']) && $field_location['#items']['0']['value'] == 'online') {
|
||||
unset($build['field_address']);
|
||||
'#weight' => -10,
|
||||
);
|
||||
|
||||
// Don't show the address if the event location is only online.
|
||||
$items = field_get_items('node', $node, 'field_location');
|
||||
|
||||
if (is_array($items)) {
|
||||
foreach ($items as $item) {
|
||||
if ($item['value'] == 'online') {
|
||||
$build['field_address']['#access'] = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -205,31 +231,50 @@ function commons_events_entity_view_alter(&$build, $type) {
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function commons_events_form_node_form_alter(&$form, &$form_state) {
|
||||
if ($form_state['node']->type == 'event') {
|
||||
$form['#attached']['css'] = array(
|
||||
drupal_get_path('module', 'commons_events') . '/css/commons_events.css',
|
||||
);
|
||||
$form['#attached']['js'] = array(
|
||||
drupal_get_path('module', 'commons_events') . '/js/commons_events.js',
|
||||
);
|
||||
function commons_events_form_node_form_alter(&$form, &$form_state, $form_id) {
|
||||
$node = $form_state['node'];
|
||||
|
||||
if ($node->type == 'event') {
|
||||
// Attach custom CSS and JS to the form.
|
||||
$form['#attached']['css'][] = drupal_get_path('module', 'commons_events') . '/css/commons_events.css';
|
||||
$form['#attached']['js'][] = drupal_get_path('module', 'commons_events') . '/js/commons_events.js';
|
||||
|
||||
// Remove the '-None-' option from all the dropdowns.
|
||||
unset($form['field_location'][$form['field_location']['#language']]['#options']['_none']);
|
||||
unset($form['field_registration_type'][$form['field_registration_type']['#language']]['#options']['_none']);
|
||||
|
||||
// Remove the registration type description.
|
||||
unset($form['field_registration'][$form['field_registration']['#language']]['0']['registration_type']['#description']);
|
||||
|
||||
// Default the event organizer to the user who is creating the node.
|
||||
if (empty($form['field_organizers'][$form['field_organizers']['#language']]['#default_value'])) {
|
||||
global $user;
|
||||
$form['field_organizers'][$form['field_organizers']['#language']]['#default_value'] = format_username($user) . " (" . $user->uid . ")";
|
||||
}
|
||||
|
||||
// Hide the Registration type field.
|
||||
$form['field_registration']['#disabled'] = commons_events_event_type_disabled($form_state['node']);
|
||||
// Address field should be hidden if event is only online.
|
||||
$form['field_registration']['#disabled'] = commons_events_event_type_disabled($node);
|
||||
|
||||
// Make the number of attendees field optional.
|
||||
$form['field_number_of_attendees'][$form['field_number_of_attendees']['#language']]['0']['value']['#required'] = FALSE;
|
||||
|
||||
// Address field should be hidden if the event is online only.
|
||||
$form['field_address']['#states'] = array(
|
||||
'invisible' => array(
|
||||
':input[name^="field_location"]' => array('value' => 'online'),
|
||||
),
|
||||
);
|
||||
// Status and attendee limit are shown if registration is onsite.
|
||||
|
||||
// Assume that registration is open by default.
|
||||
$node_registration_status = 1;
|
||||
if (isset($form_state['node']->nid)) {
|
||||
$settings = registration_entity_settings('node', $form_state['node']->nid);
|
||||
|
||||
// Use saved registration settings for existing events.
|
||||
if (isset($node->nid)) {
|
||||
$settings = registration_entity_settings('node', $node->nid);
|
||||
$node_registration_status = $settings['status'];
|
||||
}
|
||||
|
||||
// Add a status field to allow users to open and close registration.
|
||||
$form['field_status'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Status'),
|
||||
@ -245,15 +290,18 @@ function commons_events_form_node_form_alter(&$form, &$form_state) {
|
||||
),
|
||||
'#weight' => 10,
|
||||
);
|
||||
$form['field_number_of_attendees']['#states'] = $form['field_status']['#states'];
|
||||
|
||||
// Status and attendee limit are shown if registration is onsite.
|
||||
$form['field_registration']['#states'] = $form['field_status']['#states'];
|
||||
|
||||
$form['field_number_of_attendees']['#states'] = $form['field_status']['#states'];
|
||||
$form['field_number_of_attendees']['#states']['visible'][':input[name="field_status"]'] = array(
|
||||
'value' => 1,
|
||||
);
|
||||
$form['field_number_of_attendees']['#weight'] = 11;
|
||||
$form['#validate'] = array_merge(array('commons_events_node_form_validate'), $form['#validate']);
|
||||
$form['#submit'][] = 'commons_events_node_form_submit';
|
||||
// Move registration settings into a fieldset so we can move the group.
|
||||
|
||||
// Create a custom fieldset to hold the registration settings and add it to
|
||||
// the additional settings group so it will be displayed as a vertical tab.
|
||||
$form['event_registration_settings'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#collapsible' => TRUE,
|
||||
@ -262,56 +310,41 @@ function commons_events_form_node_form_alter(&$form, &$form_state) {
|
||||
'#group' => 'additional_settings',
|
||||
'#weight' => -10,
|
||||
);
|
||||
if (empty($form['field_organizers'][$form['field_organizers']['#language']]['#default_value'])) {
|
||||
global $user;
|
||||
$form['field_organizers'][$form['field_organizers']['#language']]['#default_value'] = format_username($user) . " (" . $user->uid . ")";
|
||||
}
|
||||
|
||||
// Copy all of the registration settings into the custom fieldset.
|
||||
$form['event_registration_settings']['field_organizers'] = $form['field_organizers'];
|
||||
$form['event_registration_settings']['field_registration_type'] = $form['field_registration_type'];
|
||||
$form['event_registration_settings']['field_status'] = $form['field_status'];
|
||||
$form['event_registration_settings']['field_number_of_attendees'] = $form['field_number_of_attendees'];
|
||||
unset($form['field_registration'][$form['field_registration']['#language']]['0']['registration_type']['#description']);
|
||||
$form['event_registration_settings']['field_registration'] = $form['field_registration'];
|
||||
$form['field_organizers'] = array('#language' => NULL);
|
||||
$form['field_registration_type'] = array('#language' => NULL);
|
||||
$form['field_status'] = array('#language' => NULL);
|
||||
$form['field_number_of_attendees'] = array('#language' => NULL);
|
||||
$form['field_registration'] = array('#language' => NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_commons_entity_integration().
|
||||
*/
|
||||
function commons_events_commons_entity_integration() {
|
||||
return array(
|
||||
'node' => array(
|
||||
'event' => array(
|
||||
'is_group_content' => TRUE,
|
||||
),
|
||||
),
|
||||
);
|
||||
// Unset all of the original registration settings.
|
||||
unset($form['field_organizers']);
|
||||
unset($form['field_registration_type']);
|
||||
unset($form['field_status']);
|
||||
unset($form['field_number_of_attendees']);
|
||||
unset($form['field_registration']);
|
||||
|
||||
// Add additional submission and validation handlers.
|
||||
$form['#validate'][] = 'commons_events_node_form_validate';
|
||||
$form['#submit'][] = 'commons_events_node_form_submit';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom node form validation handler.
|
||||
*/
|
||||
function commons_events_node_form_validate($form, &$form_state) {
|
||||
$lng = (isset($form_state['language']) ? $form_state['language'] : LANGUAGE_NONE);
|
||||
switch ($form_state['values']['field_registration_type'][$lng]['0']['value']) {
|
||||
$language = (isset($form_state['language']) ? $form_state['language'] : LANGUAGE_NONE);
|
||||
|
||||
switch ($form_state['values']['field_registration_type'][$language]['0']['value']) {
|
||||
case 'onsite':
|
||||
// Max attendees must be entered if the registration status is open and
|
||||
// registration is done onsite.
|
||||
if ((int) $form_state['values']['field_status'] == 1
|
||||
&& (!is_numeric($form_state['values']['field_number_of_attendees'][$lng]['0']['value']))
|
||||
) {
|
||||
form_set_error('field_number_of_attendees',
|
||||
t('Maximum number of attendees must be set for registrations to be accepted.'));
|
||||
return FALSE;
|
||||
// Max attendees must be entered if the registration is open and onsite.
|
||||
if ((int) $form_state['values']['field_status'] == 1 && (!is_numeric($form_state['values']['field_number_of_attendees'][$language]['0']['value']))) {
|
||||
form_set_error('field_number_of_attendees', t('Maximum number of attendees must be set for registrations to be accepted.'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -319,27 +352,34 @@ function commons_events_node_form_validate($form, &$form_state) {
|
||||
*/
|
||||
function commons_events_node_form_submit($form, $form_state) {
|
||||
$node = $form_state['node'];
|
||||
$lng = (isset($form_state['language']) ? $form_state['language'] : LANGUAGE_NONE);
|
||||
$language = (isset($form_state['language']) ? $form_state['language'] : LANGUAGE_NONE);
|
||||
|
||||
if (isset($node->nid)) {
|
||||
$settings = registration_entity_settings('node', $node->nid);
|
||||
$settings['status'] = (int) $form_state['values']['field_status'];
|
||||
if ($form_state['values']['field_registration_type'][$lng]['0']['value'] == 'external') {
|
||||
|
||||
if ($form_state['values']['field_registration_type'][$language]['0']['value'] == 'external') {
|
||||
$settings['status'] = 0;
|
||||
}
|
||||
if (!empty($form_state['values']['field_number_of_attendees'][$lng]['0']['value'])
|
||||
&& is_numeric($form_state['values']['field_number_of_attendees'][$lng]['0']['value'])
|
||||
) {
|
||||
$settings['capacity'] = (int) $form_state['values']['field_number_of_attendees'][$lng]['0']['value'];
|
||||
|
||||
if (!empty($form_state['values']['field_number_of_attendees'][$language]['0']['value']) && is_numeric($form_state['values']['field_number_of_attendees'][$language]['0']['value'])) {
|
||||
$settings['capacity'] = (int) $form_state['values']['field_number_of_attendees'][$language]['0']['value'];
|
||||
}
|
||||
|
||||
$settings['settings'] = serialize($settings['settings']);
|
||||
registration_update_entity_settings('node', $node->nid, $settings);
|
||||
|
||||
// Automatically register the node creator for the event.
|
||||
$registration_type = registration_get_entity_registration_type('node', $node);
|
||||
$registration = entity_get_controller('registration')->create(array(
|
||||
|
||||
$values = array(
|
||||
'entity_type' => 'node',
|
||||
'entity_id' => $node->nid,
|
||||
'type' => $registration_type,
|
||||
));
|
||||
);
|
||||
|
||||
$registration = entity_create('registration', $values);
|
||||
|
||||
if (!isset($node->uid)) {
|
||||
global $user;
|
||||
$uid = $user->uid;
|
||||
@ -347,68 +387,50 @@ function commons_events_node_form_submit($form, $form_state) {
|
||||
else {
|
||||
$uid = $node->uid;
|
||||
}
|
||||
if ($settings['status'] == 1
|
||||
&& !registration_is_registered($registration, NULL, $uid)
|
||||
) {
|
||||
|
||||
if ($settings['status'] == 1 && !registration_is_registered($registration, NULL, $uid)) {
|
||||
$registration->user_uid = $uid;
|
||||
$registration->author_uid = $uid;
|
||||
$registration->state = NULL;
|
||||
$registration->count = 1;
|
||||
|
||||
registration_save($registration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_token_info().
|
||||
*/
|
||||
function commons_events_token_info_alter(&$tokens) {
|
||||
$tokens['tokens']['node']['attend-form'] = array(
|
||||
'name' => t('Attending event form'),
|
||||
'description' => t('Displays the appropriate form for attending or cancelling event attendance'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_commons_bw_create_all_widget().
|
||||
*/
|
||||
function commons_events_commons_bw_create_all_widget($group) {
|
||||
if (og_user_access('node', $group->nid, 'create event content')) {
|
||||
$link = l(t('List an event'), 'node/add/event',
|
||||
array(
|
||||
'attributes' => array('class' => 'commons-events-create'),
|
||||
'query' => array('og_group_ref' => $group->nid),
|
||||
)
|
||||
);
|
||||
return array(
|
||||
'commons_events' => array(
|
||||
'link' => $link,
|
||||
'text' => t('Create in-person or online meetups'),
|
||||
'#weight' => 6,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_tokens().
|
||||
*/
|
||||
function commons_events_tokens($type, $tokens, array $data = array(), array $options = array()) {
|
||||
$replacements = array();
|
||||
|
||||
if ($type == 'node' && !empty($data['node'])) {
|
||||
$event = $data['node'];
|
||||
|
||||
foreach ($tokens as $name => $original) {
|
||||
if ($name == 'attend-form') {
|
||||
$replacements[$original] = theme('commons_events_attending_event', array(
|
||||
'event' => $event,
|
||||
'attendee_count' => commons_events_get_raw_attendee_count($event),
|
||||
));
|
||||
'event' => $event,
|
||||
'attendee_count' => commons_events_get_raw_attendee_count($event),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $replacements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_token_info_alter().
|
||||
*/
|
||||
function commons_events_token_info_alter(&$tokens) {
|
||||
$tokens['tokens']['node']['attend-form'] = array(
|
||||
'name' => t('Attending event form'),
|
||||
'description' => t('Displays the appropriate form for attending or cancelling event attendance'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the 'more' link for upcoming events in a specific group.
|
||||
*/
|
||||
@ -419,13 +441,16 @@ function commons_events_upcoming_more_link($group_id) {
|
||||
'f[1]' => 'sm_og_group_ref:node:' . $group_id,
|
||||
),
|
||||
);
|
||||
|
||||
return l(t('more'), 'events', $options);
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'query' => array(
|
||||
'gid' => $group_id,
|
||||
),
|
||||
);
|
||||
|
||||
return l(t('more'), 'events', $options);
|
||||
}
|
||||
|
||||
@ -433,17 +458,12 @@ function commons_events_upcoming_more_link($group_id) {
|
||||
* Implements hook_views_post_execute().
|
||||
*/
|
||||
function commons_events_views_post_execute(&$view) {
|
||||
if ($view->name == 'commons_events_upcoming'
|
||||
&& $view->current_display == 'panel_pane_1'
|
||||
) {
|
||||
if ($view->name == 'commons_events_upcoming' && $view->current_display == 'panel_pane_1') {
|
||||
$view->attachment_after = '<div class="more-link">' . commons_events_upcoming_more_link($view->args[0]) . '</div>';
|
||||
}
|
||||
else {
|
||||
if ($view->name == 'commons_events_upcoming'
|
||||
&& $view->current_display == 'panel_pane_2'
|
||||
) {
|
||||
$view->attachment_before = '<div class="commons-event-count">' . format_plural(count($view->result), '1 event', '@count events') . '</div>';
|
||||
}
|
||||
|
||||
if ($view->name == 'commons_events_upcoming' && $view->current_display == 'panel_pane_2') {
|
||||
$view->attachment_before = '<div class="commons-event-count">' . format_plural(count($view->result), '1 event', '@count events') . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -451,16 +471,15 @@ function commons_events_views_post_execute(&$view) {
|
||||
* Implements hook_block_info().
|
||||
*/
|
||||
function commons_events_block_info() {
|
||||
$blocks = array(
|
||||
'commons_events_create_event_link' => array(
|
||||
'info' => t('"Create an event" call to action'),
|
||||
'cache' => DRUPAL_CACHE_GLOBAL,
|
||||
),
|
||||
'commons_events_anonymous_login' => array(
|
||||
'info' => t('"Login to create an event" call to action'),
|
||||
'cache' => DRUPAL_CACHE_GLOBAL,
|
||||
),
|
||||
$blocks['commons_events_create_event_link'] = array(
|
||||
'info' => t('"Create an event" call to action'),
|
||||
'cache' => DRUPAL_CACHE_GLOBAL,
|
||||
);
|
||||
$blocks['commons_events_anonymous_login'] = array(
|
||||
'info' => t('"Login to create an event" call to action'),
|
||||
'cache' => DRUPAL_CACHE_GLOBAL,
|
||||
);
|
||||
|
||||
return $blocks;
|
||||
}
|
||||
|
||||
@ -468,30 +487,33 @@ function commons_events_block_info() {
|
||||
* Implements hook_block_view().
|
||||
*/
|
||||
function commons_events_block_view($delta = '') {
|
||||
global $user;
|
||||
if ($delta == 'commons_events_create_event_link'
|
||||
&& node_access('create', 'event')
|
||||
) {
|
||||
$options = array(
|
||||
'query' => array(
|
||||
'destination' => 'events',
|
||||
),
|
||||
);
|
||||
return array(
|
||||
'subject' => NULL,
|
||||
'content' => l(t('List an event'), 'node/add/event', $options),
|
||||
);
|
||||
}
|
||||
else {
|
||||
if ($delta == 'commons_events_anonymous_login'
|
||||
&& empty($user->uid)
|
||||
) {
|
||||
return array(
|
||||
'subject' => NULL,
|
||||
'content' => t('You must !login in order to list events.', array('!login' => l(t('log in'), 'user'))),
|
||||
);
|
||||
}
|
||||
$block = array();
|
||||
|
||||
switch ($delta) {
|
||||
case 'commons_events_create_event_link':
|
||||
if (node_access('create', 'event')) {
|
||||
$block['subject'] = NULL;
|
||||
$block['content'] = array(
|
||||
'#type' => 'link',
|
||||
'#title' => t('List an event'),
|
||||
'#href' => 'node/add/event',
|
||||
'#options' => array(
|
||||
'query' => array(
|
||||
'destination' => 'events',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'commons_events_anonymous_login':
|
||||
if (user_is_anonymous()) {
|
||||
$block['subject'] = NULL;
|
||||
$block['content'] = t('You must !login in order to list events.', array('!login' => l(t('log in'), 'user')));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -620,6 +642,7 @@ function commons_events_event_type_disabled($node) {
|
||||
if (!isset($node->nid) || empty($node->nid)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$registrations = db_select('registration', 'r')
|
||||
->fields('r')
|
||||
->condition('entity_type', 'node')
|
||||
@ -627,9 +650,11 @@ function commons_events_event_type_disabled($node) {
|
||||
->countQuery()
|
||||
->execute()
|
||||
->fetchCol();
|
||||
|
||||
if ($registrations[0] > 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -637,13 +662,17 @@ function commons_events_event_type_disabled($node) {
|
||||
* Helper function go get the raw number of attendees.
|
||||
*/
|
||||
function commons_events_get_raw_attendee_count($node) {
|
||||
$attendee_count = db_select('registration', 'r')
|
||||
->fields('r')
|
||||
$attendee_count = 0;
|
||||
$query = db_select('registration', 'r')
|
||||
->fields('r', array('count'))
|
||||
->condition('entity_id', $node->nid)
|
||||
->condition('entity_type', 'node')
|
||||
->countQuery()
|
||||
->execute()
|
||||
->fetchField();
|
||||
->execute();
|
||||
|
||||
// Add up all of the attendees going to the event.
|
||||
foreach ($query as $record) {
|
||||
$attendee_count += $record->count;
|
||||
}
|
||||
|
||||
return $attendee_count;
|
||||
}
|
@ -231,12 +231,11 @@ function commons_events_views_default_views() {
|
||||
$handler->display->display_options['style_plugin'] = 'default';
|
||||
$handler->display->display_options['row_plugin'] = 'fields';
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: Content: Date */
|
||||
$handler->display->display_options['fields']['field_date']['id'] = 'field_date';
|
||||
$handler->display->display_options['fields']['field_date']['table'] = 'field_data_field_date';
|
||||
@ -348,12 +347,11 @@ function commons_events_views_default_views() {
|
||||
$handler->display->display_options['relationships']['og_membership_rel']['required'] = TRUE;
|
||||
$handler->display->display_options['defaults']['fields'] = FALSE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: Content: Date */
|
||||
$handler->display->display_options['fields']['field_date']['id'] = 'field_date';
|
||||
$handler->display->display_options['fields']['field_date']['table'] = 'field_data_field_date';
|
||||
@ -524,17 +522,18 @@ function commons_events_views_default_views() {
|
||||
$handler->display->display_options['relationships']['user_uid']['relationship'] = 'registration_rel';
|
||||
$handler->display->display_options['relationships']['user_uid']['required'] = TRUE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
/* Sort criterion: Content: Post date */
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Sort criterion: Content: Date - start date (field_date) */
|
||||
$handler->display->display_options['sorts']['created']['id'] = 'created';
|
||||
$handler->display->display_options['sorts']['field_date_value']['id'] = 'field_date_value';
|
||||
$handler->display->display_options['sorts']['created']['table'] = 'node';
|
||||
$handler->display->display_options['sorts']['field_date_value']['table'] = 'field_data_field_date';
|
||||
$handler->display->display_options['sorts']['created']['field'] = 'created';
|
||||
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
|
||||
$handler->display->display_options['sorts']['field_date_value']['field'] = 'field_date_value';
|
||||
/* Contextual filter: Registration: User */
|
||||
$handler->display->display_options['arguments']['user_uid']['id'] = 'user_uid';
|
||||
$handler->display->display_options['arguments']['user_uid']['table'] = 'registration';
|
||||
@ -559,6 +558,13 @@ function commons_events_views_default_views() {
|
||||
$handler->display->display_options['filters']['type']['value'] = array(
|
||||
'event' => 'event',
|
||||
);
|
||||
/* Filter criterion: Content: Date - start date (field_date) */
|
||||
$handler->display->display_options['filters']['field_date_value']['id'] = 'field_date_value';
|
||||
$handler->display->display_options['filters']['field_date_value']['table'] = 'field_data_field_date';
|
||||
$handler->display->display_options['filters']['field_date_value']['field'] = 'field_date_value';
|
||||
$handler->display->display_options['filters']['field_date_value']['operator'] = '>=';
|
||||
$handler->display->display_options['filters']['field_date_value']['form_type'] = 'date_text';
|
||||
$handler->display->display_options['filters']['field_date_value']['default_date'] = 'now';
|
||||
|
||||
/* Display: Block */
|
||||
$handler = $view->new_display('block', 'Block', 'block');
|
||||
@ -582,12 +588,11 @@ function commons_events_views_default_views() {
|
||||
$handler->display->display_options['defaults']['empty'] = FALSE;
|
||||
$handler->display->display_options['defaults']['fields'] = FALSE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: Content: Address */
|
||||
$handler->display->display_options['fields']['field_address']['id'] = 'field_address';
|
||||
$handler->display->display_options['fields']['field_address']['table'] = 'field_data_field_address';
|
||||
@ -650,12 +655,11 @@ function commons_events_views_default_views() {
|
||||
$handler->display->display_options['defaults']['relationships'] = FALSE;
|
||||
$handler->display->display_options['defaults']['fields'] = FALSE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: Content: Address */
|
||||
$handler->display->display_options['fields']['field_address']['id'] = 'field_address';
|
||||
$handler->display->display_options['fields']['field_address']['table'] = 'field_data_field_address';
|
||||
@ -722,12 +726,11 @@ function commons_events_views_default_views() {
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['flag'] = 'commons_follow_node';
|
||||
$handler->display->display_options['defaults']['fields'] = FALSE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: Content: Address */
|
||||
$handler->display->display_options['fields']['field_address']['id'] = 'field_address';
|
||||
$handler->display->display_options['fields']['field_address']['table'] = 'field_data_field_address';
|
||||
|
@ -28,7 +28,7 @@
|
||||
padding: 0px;
|
||||
}
|
||||
#edit-field-date .fieldset-wrapper .form-item:first-child,
|
||||
#edit-field-date .form-item .form-item,
|
||||
#edit-field-date .form-item .form-item,
|
||||
#edit-field-address .fieldset-wrapper .form-item:first-child,
|
||||
#edit-field-address .form-item {
|
||||
margin-top: 0em;
|
||||
|
@ -22,10 +22,19 @@ function commons_events_attend_event_form($form, &$form_state, $event_node, $reg
|
||||
));
|
||||
}
|
||||
$form_state['registration'] = $registration;
|
||||
|
||||
$form['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Attend'),
|
||||
);
|
||||
$form['count'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => '0',
|
||||
'#description' => ' + Guests',
|
||||
'#size' => 2,
|
||||
'#maxlength' => 2,
|
||||
'#required' => false,
|
||||
);
|
||||
$form['attending'] = array(
|
||||
'#theme_wrappers' => array('container'),
|
||||
'#attributes' => array(
|
||||
@ -47,12 +56,26 @@ function commons_events_attend_event_form($form, &$form_state, $event_node, $reg
|
||||
*/
|
||||
function commons_events_attend_event_form_validate($form, &$form_state) {
|
||||
global $user;
|
||||
if ($form_state['values']['count'] == '') {
|
||||
$form_state['values']['count'] = 0;
|
||||
}
|
||||
|
||||
if (!is_numeric($form_state['values']['count'])) {
|
||||
form_set_error('count', t('Guest count must be a number.'));
|
||||
return FALSE;
|
||||
}
|
||||
// Include the registrant in the count.
|
||||
$form_state['values']['count']++;
|
||||
|
||||
if (!registration_has_room('node', $form_state['event_node']->nid, $form_state['values']['count'])) {
|
||||
form_set_error('count', t('Insufficient spaces remaining.'));
|
||||
}
|
||||
if (!registration_status('node', $form_state['event_node']->nid, TRUE)
|
||||
|| !registration_has_room('node', $form_state['event_node']->nid)) {
|
||||
form_set_error('submit', t('The event you are registering for is unavailable.'));
|
||||
return FALSE;
|
||||
}
|
||||
else if (registration_is_registered($form_state['registration'], NULL, $user->uid)) {
|
||||
elseif (registration_is_registered($form_state['registration'], NULL, $user->uid)) {
|
||||
form_set_error('submit', t('You are already registered for this event.'));
|
||||
return FALSE;
|
||||
}
|
||||
@ -68,7 +91,7 @@ function commons_events_attend_event_form_submit($form, $form_state) {
|
||||
$registration->user_uid = $user->uid;
|
||||
$registration->author_uid = $user->uid;
|
||||
$registration->state = NULL;
|
||||
$registration->count = 1;
|
||||
$registration->count = $form_state['values']['count'];
|
||||
if (registration_save($registration)) {
|
||||
drupal_set_message(t('Your registration was saved.'));
|
||||
commons_follow_node_follow_node($registration->entity_id, 'event', $user->uid);
|
||||
@ -81,23 +104,43 @@ function commons_events_attend_event_form_submit($form, $form_state) {
|
||||
/**
|
||||
* Form to cancel a registration for an event.
|
||||
*/
|
||||
function commons_events_cancel_event_form($form, &$form_state, $event) {
|
||||
function commons_events_cancel_event_form($form, &$form_state, $event, $registrations) {
|
||||
$form_state['event'] = $event;
|
||||
|
||||
$form['#attributes'] = array('class' => array('commons-events-form-float'));
|
||||
$form['#attached']['css'] = array(
|
||||
drupal_get_path('module', 'commons_events') . '/css/commons_events.css',
|
||||
);
|
||||
$form['registration'] = array(
|
||||
'#type' => 'value',
|
||||
'#value' => $registrations,
|
||||
);
|
||||
$form['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Cancel'),
|
||||
);
|
||||
$form['submit']['#attributes']['class'][] = 'commons-events-button';
|
||||
|
||||
$attendee_count = 0;
|
||||
foreach ($registrations as $registration) {
|
||||
$attendee_count += registration_event_count('node', $event->nid, $registration->registration_id);
|
||||
}
|
||||
// Remove registrant from count.
|
||||
$attendee_count--;
|
||||
if ($attendee_count > 1) {
|
||||
// Single attending message.
|
||||
$markup = t('You are attending with @guests', array('@guests' => format_plural($attendee_count, '1 guest', '@count guests')));
|
||||
}
|
||||
else {
|
||||
$markup = t('You are attending.');
|
||||
}
|
||||
|
||||
$form['attending'] = array(
|
||||
'#theme_wrappers' => array('container'),
|
||||
'#attributes' => array(
|
||||
'class' => array('commons-event-status'),
|
||||
),
|
||||
'#markup' => t('You are attending.'),
|
||||
'#markup' => $markup,
|
||||
);
|
||||
return $form;
|
||||
}
|
||||
@ -106,16 +149,9 @@ function commons_events_cancel_event_form($form, &$form_state, $event) {
|
||||
* Event cancel attendance form submit handler.
|
||||
*/
|
||||
function commons_events_cancel_event_form_submit($form, $form_state) {
|
||||
global $user;
|
||||
$event = $form_state['event'];
|
||||
$query = new EntityFieldQuery();
|
||||
$query->entityCondition('entity_type', 'registration')
|
||||
->propertyCondition('user_uid', $user->uid)
|
||||
->propertyCondition('entity_id', $event->nid)
|
||||
->propertyCondition('entity_type', 'node');
|
||||
$result = $query->execute();
|
||||
if (isset($result['registration'])) {
|
||||
registration_delete_multiple(array_keys($result['registration']));
|
||||
if (isset($form_state['values']['registration'])) {
|
||||
registration_delete_multiple(array_keys($form_state['values']['registration']));
|
||||
drupal_set_message(t('Your registration has been cancelled.'));
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,10 @@
|
||||
function theme_commons_events_attending_event($variables = array()) {
|
||||
global $user;
|
||||
$event = $variables['event'];
|
||||
if (!$event->nid) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$attendee_count = isset($variables['attendee_count']) ? $variables['attendee_count'] : 0;
|
||||
|
||||
$registration_type = registration_get_entity_registration_type('node', $event);
|
||||
@ -29,9 +33,16 @@ function theme_commons_events_attending_event($variables = array()) {
|
||||
&& registration_status('node', $event->nid, TRUE)) {
|
||||
return drupal_get_form('commons_events_attend_event_form_' . $event->nid, $event, $registration, $attendee_count);
|
||||
}
|
||||
else if (registration_is_registered($registration, NULL, $user->uid) &&
|
||||
elseif (registration_is_registered($registration, NULL, $user->uid) &&
|
||||
registration_access('delete', $registration, $user, $registration->type)) {
|
||||
return drupal_get_form('commons_events_cancel_event_form_' . $event->nid, $event);
|
||||
$query = new EntityFieldQuery();
|
||||
$query->entityCondition('entity_type', 'registration')
|
||||
->propertyCondition('user_uid', $user->uid)
|
||||
->propertyCondition('entity_id', $event->nid)
|
||||
->propertyCondition('entity_type', 'node');
|
||||
$result = $query->execute();
|
||||
|
||||
return drupal_get_form('commons_events_cancel_event_form_' . $event->nid, $event, $result['registration']);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -12,3 +12,10 @@ features[panelizer_defaults][] = node:event:default
|
||||
features[variable][] = panelizer_defaults_node_event
|
||||
files[] = commons_events_pages.features.inc
|
||||
files[] = commons_events_pages.strongarm.inc
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -19,3 +19,10 @@ features[features_api][] = api:2
|
||||
features[page_manager_existing_pages][] = solr_events_search
|
||||
features[page_manager_handlers][] = pm_existing_pages_solr_events_search_panel_context
|
||||
features[variable][] = pm_existing_pages_disabled_solr_events_search
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -7,3 +7,10 @@ dependencies[] = views_content
|
||||
features[ctools][] = views:views_default:3.0
|
||||
features[features_api][] = api:2
|
||||
features[views_view][] = commons_featured
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
12
modules/commons/commons_featured/commons_featured.install
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Replace the title attribute with the title field in view displays.
|
||||
*/
|
||||
function commons_featured_update_7300() {
|
||||
$revert = array(
|
||||
'commons_featured' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
@ -42,14 +42,13 @@ function commons_featured_views_default_views() {
|
||||
$handler->display->display_options['fields']['type']['exclude'] = TRUE;
|
||||
$handler->display->display_options['fields']['type']['element_label_colon'] = FALSE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['element_class'] = 'type-[type]';
|
||||
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['element_class'] = 'type-[type]';
|
||||
$handler->display->display_options['fields']['title_field']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: Content: Date */
|
||||
$handler->display->display_options['fields']['field_date']['id'] = 'field_date';
|
||||
$handler->display->display_options['fields']['field_date']['table'] = 'field_data_field_date';
|
||||
|
@ -4,6 +4,34 @@
|
||||
* commons_follow.features.inc
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_features_pipe_alter().
|
||||
*
|
||||
*/
|
||||
function commons_follow_features_pipe_alter(&$pipe, $data, $export) {
|
||||
$commons_follow_fields = array(
|
||||
'field_target_users', 'field_target_nodes', 'field_target_comments',
|
||||
);
|
||||
// Prevent Commons Follow fields from being piped in features
|
||||
// when a content type includes those fields.
|
||||
if (!empty($pipe['field_instance'])) {
|
||||
foreach ($pipe['field_instance'] as $delta => $value) {
|
||||
$args = explode('-', $value);
|
||||
$field_name = $args[2];
|
||||
if (in_array($field_name, $commons_follow_fields)) {
|
||||
unset($pipe['field_instance'][$delta]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($pipe['field_base'])) {
|
||||
foreach ($pipe['field_base'] as $delta => $value) {
|
||||
if (in_array($delta, $commons_follow_fields)) {
|
||||
unset($pipe['field_base'][$delta]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_plugin_api().
|
||||
*/
|
||||
|
@ -22,4 +22,10 @@ files[] = includes/views/handlers/commons_follow_plugin_argument_default_node.in
|
||||
files[] = includes/views/handlers/commons_follow_plugin_argument_default_message.inc
|
||||
files[] = includes/views/handlers/commons_follow_user_follow_filter.inc
|
||||
files[] = includes/views/handlers/commons_follow_user_follow_filter_message.inc
|
||||
files[] = includes/views/handlers/commons_follow_handler_field_ops.inc
|
||||
files[] = includes/views/handlers/commons_follow_handler_field_ops.inc
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -19,34 +19,6 @@ function commons_follow_theme() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_features_pipe_alter().
|
||||
*
|
||||
*/
|
||||
function commons_follow_features_pipe_alter(&$pipe, $data, $export) {
|
||||
$commons_follow_fields = array(
|
||||
'field_target_users', 'field_target_nodes', 'field_target_comments',
|
||||
);
|
||||
// Prevent Commons Follow fields from being piped in features
|
||||
// when a content type includes those fields.
|
||||
if (!empty($pipe['field_instance'])) {
|
||||
foreach ($pipe['field_instance'] as $delta => $value) {
|
||||
$args = explode('-', $value);
|
||||
$field_name = $args[2];
|
||||
if (in_array($field_name, $commons_follow_fields)) {
|
||||
unset($pipe['field_instance'][$delta]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($pipe['field_base'])) {
|
||||
foreach ($pipe['field_base'] as $delta => $value) {
|
||||
if (in_array($delta, $commons_follow_fields)) {
|
||||
unset($pipe['field_base'][$delta]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_default_views_alter().
|
||||
*
|
||||
|
@ -18,6 +18,7 @@ function commons_follow_group_ctools_plugin_api($module = NULL, $api = NULL) {
|
||||
*/
|
||||
function commons_follow_group_flag_default_flags() {
|
||||
$flags = array();
|
||||
|
||||
// Exported flag: "Groups".
|
||||
$flags['commons_follow_group'] = array(
|
||||
'content_type' => 'node',
|
||||
@ -55,6 +56,7 @@ function commons_follow_group_flag_default_flags() {
|
||||
),
|
||||
'api_version' => 2,
|
||||
);
|
||||
|
||||
// Exported flag: "Commons Follow (Groups - Email)".
|
||||
$flags['email_group'] = array(
|
||||
'content_type' => 'node',
|
||||
@ -92,6 +94,6 @@ function commons_follow_group_flag_default_flags() {
|
||||
),
|
||||
'api_version' => 2,
|
||||
);
|
||||
return $flags;
|
||||
|
||||
return $flags;
|
||||
}
|
||||
|
@ -11,3 +11,10 @@ features[features_api][] = api:2
|
||||
features[flag][] = commons_follow_group
|
||||
features[flag][] = email_group
|
||||
features[variable][] = message_subscribe_og
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -101,8 +101,9 @@ function commons_follow_group_node_insert($node) {
|
||||
}
|
||||
// The owner of the content automatically follows the content
|
||||
$account = user_load($node->uid);
|
||||
$flag = flag_get_flag('commons_follow_group');
|
||||
$flag->flag('flag', $node->nid, $account);
|
||||
if ($flag = flag_get_flag('commons_follow_group')) {
|
||||
$flag->flag('flag', $node->nid, $account);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -149,3 +150,5 @@ function commons_follow_group_sync_flag_to_group_membership($og_membership) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@ function commons_follow_node_views_api($module = NULL, $api = NULL) {
|
||||
*/
|
||||
function commons_follow_node_flag_default_flags() {
|
||||
$flags = array();
|
||||
|
||||
// Exported flag: "Other content you follow".
|
||||
$flags['commons_follow_node'] = array(
|
||||
'content_type' => 'node',
|
||||
@ -51,41 +52,16 @@ function commons_follow_node_flag_default_flags() {
|
||||
),
|
||||
'api_version' => 2,
|
||||
);
|
||||
// Exported flag: "Email content".
|
||||
$flags['email_node'] = array(
|
||||
'content_type' => 'node',
|
||||
'title' => 'Email content',
|
||||
'global' => 0,
|
||||
'types' => array(),
|
||||
'flag_short' => 'Send Email',
|
||||
'flag_long' => '',
|
||||
'flag_message' => '',
|
||||
'unflag_short' => 'Don\'t send Email',
|
||||
'unflag_long' => '',
|
||||
'unflag_message' => '',
|
||||
'unflag_denied_text' => '',
|
||||
'link_type' => 'toggle',
|
||||
'roles' => array(
|
||||
'flag' => array(
|
||||
0 => 2,
|
||||
),
|
||||
'unflag' => array(
|
||||
0 => 2,
|
||||
),
|
||||
),
|
||||
'weight' => 0,
|
||||
'show_on_form' => 0,
|
||||
'access_author' => '',
|
||||
'show_on_page' => 0,
|
||||
'show_on_teaser' => 0,
|
||||
'show_contextual_link' => 0,
|
||||
'i18n' => 0,
|
||||
'module' => 'commons_follow_node',
|
||||
'locked' => array(
|
||||
0 => 'name',
|
||||
),
|
||||
'api_version' => 2,
|
||||
);
|
||||
return $flags;
|
||||
|
||||
return $flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_flag_default_flags_alter().
|
||||
*/
|
||||
function commons_follow_node_flag_default_flags_alter(&$flags) {
|
||||
// Enable the default email_node flag provided by Message Subscribe Email.
|
||||
if (!empty($flags['email_node'])) {
|
||||
$flags['email_node']['status'] = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ dependencies[] = views_litepager
|
||||
features[ctools][] = views:views_default:3.0
|
||||
features[features_api][] = api:2
|
||||
features[flag][] = commons_follow_node
|
||||
features[flag][] = email_node
|
||||
features[views_view][] = commons_follow_node
|
||||
features_exclude[dependencies][views] = views
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -18,4 +18,15 @@ function commons_follow_node_update_3501() {
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the title attribute with the title field in view displays.
|
||||
*/
|
||||
function commons_follow_node_update_3502() {
|
||||
$revert = array(
|
||||
'commons_follow_node' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
@ -76,11 +76,11 @@ function commons_follow_node_comment_insert($comment) {
|
||||
* @see commons_follow_node_node_insert
|
||||
*/
|
||||
function commons_follow_node_follow_node($nid, $content_type, $user_id = NULL) {
|
||||
$flag = flag_get_flag('commons_follow_node');
|
||||
|
||||
// Check if this content type use the "Individual nodes" flag
|
||||
if (in_array($content_type, $flag->types)) {
|
||||
$account = isset($user_id) ? user_load($user_id) : NULL;
|
||||
$flag->flag('flag', $nid, $account);
|
||||
if ($flag = flag_get_flag('commons_follow_node')) {
|
||||
// Check if this content type use the "Individual nodes" flag
|
||||
if (in_array($content_type, $flag->types)) {
|
||||
$account = isset($user_id) ? user_load($user_id) : NULL;
|
||||
$flag->flag('flag', $nid, $account);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,11 +88,10 @@ function commons_follow_node_views_default_views() {
|
||||
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
|
||||
$handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel';
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: Flags: Flag link */
|
||||
$handler->display->display_options['fields']['ops_1']['id'] = 'ops_1';
|
||||
$handler->display->display_options['fields']['ops_1']['table'] = 'flag_content';
|
||||
|
@ -16,6 +16,7 @@ function commons_follow_term_views_api($module = NULL, $api = NULL) {
|
||||
*/
|
||||
function commons_follow_term_flag_default_flags() {
|
||||
$flags = array();
|
||||
|
||||
// Exported flag: "Topics you follow".
|
||||
$flags['commons_follow_term'] = array(
|
||||
'content_type' => 'taxonomy_term',
|
||||
@ -50,40 +51,16 @@ function commons_follow_term_flag_default_flags() {
|
||||
),
|
||||
'api_version' => 2,
|
||||
);
|
||||
// Exported flag: "Email term".
|
||||
$flags['email_term'] = array(
|
||||
'content_type' => 'taxonomy_term',
|
||||
'title' => 'Email term',
|
||||
'global' => 0,
|
||||
'types' => array(
|
||||
0 => 'topics',
|
||||
),
|
||||
'flag_short' => 'Send Email',
|
||||
'flag_long' => '',
|
||||
'flag_message' => '',
|
||||
'unflag_short' => 'Don\'t send Email',
|
||||
'unflag_long' => '',
|
||||
'unflag_message' => '',
|
||||
'unflag_denied_text' => '',
|
||||
'link_type' => 'toggle',
|
||||
'roles' => array(
|
||||
'flag' => array(
|
||||
0 => 2,
|
||||
),
|
||||
'unflag' => array(
|
||||
0 => 2,
|
||||
),
|
||||
),
|
||||
'weight' => 0,
|
||||
'show_on_entity' => 1,
|
||||
'show_on_form' => 0,
|
||||
'access_author' => '',
|
||||
'module' => 'commons_follow_term',
|
||||
'locked' => array(
|
||||
0 => 'name',
|
||||
),
|
||||
'api_version' => 2,
|
||||
);
|
||||
return $flags;
|
||||
|
||||
return $flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_flag_default_flags_alter().
|
||||
*/
|
||||
function commons_follow_term_flag_default_flags_alter(&$flags) {
|
||||
// Enable the default email_term flag provided by Message Subscribe Email.
|
||||
if (!empty($flags['email_term'])) {
|
||||
$flags['email_term']['status'] = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,12 @@ dependencies[] = views_litepager
|
||||
features[ctools][] = views:views_default:3.0
|
||||
features[features_api][] = api:2
|
||||
features[flag][] = commons_follow_term
|
||||
features[flag][] = email_term
|
||||
features[views_view][] = commons_follow_taxonomy_term
|
||||
features_exclude[dependencies][ctools] = ctools
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -5,3 +5,10 @@ package = Commons - Building blocks
|
||||
dependencies[] = commons_follow
|
||||
dependencies[] = message_subscribe_ui
|
||||
dependencies[] = quicktabs
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -25,6 +25,7 @@ function commons_follow_user_views_api($module = NULL, $api = NULL) {
|
||||
*/
|
||||
function commons_follow_user_flag_default_flags() {
|
||||
$flags = array();
|
||||
|
||||
// Exported flag: "People".
|
||||
$flags['commons_follow_user'] = array(
|
||||
'content_type' => 'user',
|
||||
@ -58,41 +59,18 @@ function commons_follow_user_flag_default_flags() {
|
||||
),
|
||||
'api_version' => 2,
|
||||
);
|
||||
// Exported flag: "Email user".
|
||||
$flags['email_user'] = array(
|
||||
'content_type' => 'user',
|
||||
'title' => 'Email user',
|
||||
'global' => 0,
|
||||
'types' => array(),
|
||||
'flag_short' => 'Send Email',
|
||||
'flag_long' => '',
|
||||
'flag_message' => '',
|
||||
'unflag_short' => 'Don\'t send Email',
|
||||
'unflag_long' => '',
|
||||
'unflag_message' => '',
|
||||
'unflag_denied_text' => '',
|
||||
'link_type' => 'toggle',
|
||||
'roles' => array(
|
||||
'flag' => array(
|
||||
0 => 2,
|
||||
),
|
||||
'unflag' => array(
|
||||
0 => 2,
|
||||
),
|
||||
),
|
||||
'weight' => 0,
|
||||
'show_on_form' => 0,
|
||||
'access_author' => '',
|
||||
'show_on_profile' => 0,
|
||||
'access_uid' => '',
|
||||
'module' => 'commons_follow_user',
|
||||
'locked' => array(
|
||||
0 => 'name',
|
||||
),
|
||||
'api_version' => 2,
|
||||
);
|
||||
return $flags;
|
||||
|
||||
return $flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_flag_default_flags_alter().
|
||||
*/
|
||||
function commons_follow_user_flag_default_flags_alter(&$flags) {
|
||||
// Enable the default email_user flag provided by Message Subscribe Email.
|
||||
if (!empty($flags['email_user'])) {
|
||||
$flags['email_user']['status'] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +84,10 @@ function commons_follow_user_default_message_type() {
|
||||
"argument_keys" : [],
|
||||
"argument" : [],
|
||||
"category" : "message_type",
|
||||
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
|
||||
"data" : {
|
||||
"token options" : { "clear" : 1 },
|
||||
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
|
||||
},
|
||||
"language" : "",
|
||||
"arguments" : null,
|
||||
"message_text" : { "und" : [
|
||||
|
@ -14,8 +14,14 @@ features[ctools][] = views:views_default:3.0
|
||||
features[features_api][] = api:2
|
||||
features[field_instance][] = message-commons_follow_user_user_followed-field_target_users
|
||||
features[flag][] = commons_follow_user
|
||||
features[flag][] = email_user
|
||||
features[message_type][] = commons_follow_user_user_followed
|
||||
features[views_view][] = commons_follow_user
|
||||
features[views_view][] = commons_follow_user_followers
|
||||
features[views_view][] = commons_follow_user_following
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -26,4 +26,15 @@ function commons_follow_user_update_3501() {
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert the following / followers view to use an unformatted style plugin.
|
||||
*/
|
||||
function commons_follow_user_update_3502() {
|
||||
$revert = array(
|
||||
'commons_follow_user' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
@ -182,8 +182,14 @@ function commons_follow_user_views_default_views() {
|
||||
$handler->display->display_options['pager']['type'] = 'some';
|
||||
$handler->display->display_options['pager']['options']['items_per_page'] = '16';
|
||||
$handler->display->display_options['pager']['options']['offset'] = '0';
|
||||
$handler->display->display_options['style_plugin'] = 'grid';
|
||||
$handler->display->display_options['style_plugin'] = 'list';
|
||||
$handler->display->display_options['style_options']['row_class'] = 'profile-badge';
|
||||
$handler->display->display_options['style_options']['default_row_class'] = FALSE;
|
||||
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
|
||||
$handler->display->display_options['style_options']['class'] = 'profile-badges';
|
||||
$handler->display->display_options['style_options']['wrapper_class'] = 'view-profile-badges';
|
||||
$handler->display->display_options['row_plugin'] = 'fields';
|
||||
$handler->display->display_options['row_options']['default_field_elements'] = FALSE;
|
||||
/* No results behavior: Global: Text area */
|
||||
$handler->display->display_options['empty']['area']['id'] = 'area';
|
||||
$handler->display->display_options['empty']['area']['table'] = 'views';
|
||||
@ -204,21 +210,27 @@ function commons_follow_user_views_default_views() {
|
||||
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
|
||||
$handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel';
|
||||
$handler->display->display_options['relationships']['uid']['required'] = TRUE;
|
||||
/* 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']['relationship'] = 'uid';
|
||||
$handler->display->display_options['fields']['name']['label'] = '';
|
||||
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
|
||||
/* Field: User: Picture */
|
||||
$handler->display->display_options['fields']['picture']['id'] = 'picture';
|
||||
$handler->display->display_options['fields']['picture']['table'] = 'users';
|
||||
$handler->display->display_options['fields']['picture']['field'] = 'picture';
|
||||
$handler->display->display_options['fields']['picture']['relationship'] = 'uid';
|
||||
$handler->display->display_options['fields']['picture']['label'] = '';
|
||||
$handler->display->display_options['fields']['picture']['element_type'] = 'div';
|
||||
$handler->display->display_options['fields']['picture']['element_class'] = 'profile-badge-picture';
|
||||
$handler->display->display_options['fields']['picture']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['picture']['element_default_classes'] = FALSE;
|
||||
$handler->display->display_options['fields']['picture']['image_style'] = '50x50_avatar';
|
||||
/* 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']['relationship'] = 'uid';
|
||||
$handler->display->display_options['fields']['name']['label'] = '';
|
||||
$handler->display->display_options['fields']['name']['element_type'] = 'span';
|
||||
$handler->display->display_options['fields']['name']['element_class'] = 'profile-badge-name';
|
||||
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['name']['element_default_classes'] = FALSE;
|
||||
/* Sort criterion: Flags: Flagged time */
|
||||
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
|
||||
$handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content';
|
||||
@ -323,9 +335,15 @@ function commons_follow_user_views_default_views() {
|
||||
$handler->display->display_options['pager']['type'] = 'some';
|
||||
$handler->display->display_options['pager']['options']['items_per_page'] = '16';
|
||||
$handler->display->display_options['pager']['options']['offset'] = '0';
|
||||
$handler->display->display_options['style_plugin'] = 'grid';
|
||||
$handler->display->display_options['style_plugin'] = 'list';
|
||||
$handler->display->display_options['style_options']['row_class'] = 'profile-badge';
|
||||
$handler->display->display_options['style_options']['default_row_class'] = FALSE;
|
||||
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
|
||||
$handler->display->display_options['style_options']['class'] = 'profile-badges';
|
||||
$handler->display->display_options['style_options']['wrapper_class'] = 'view-profile-badges';
|
||||
$handler->display->display_options['row_plugin'] = 'fields';
|
||||
/* No results behavior: Global: Text area */
|
||||
$handler->display->display_options['row_options']['hide_empty'] = TRUE;
|
||||
$handler->display->display_options['row_options']['default_field_elements'] = FALSE; /* No results behavior: Global: Text area */
|
||||
$handler->display->display_options['empty']['area']['id'] = 'area';
|
||||
$handler->display->display_options['empty']['area']['table'] = 'views';
|
||||
$handler->display->display_options['empty']['area']['field'] = 'area';
|
||||
@ -341,20 +359,26 @@ function commons_follow_user_views_default_views() {
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['label'] = 'Commons Follow (Users)';
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['flag'] = 'commons_follow_user';
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['user_scope'] = 'any';
|
||||
/* Field: User: Picture */
|
||||
$handler->display->display_options['fields']['picture']['id'] = 'picture';
|
||||
$handler->display->display_options['fields']['picture']['table'] = 'users';
|
||||
$handler->display->display_options['fields']['picture']['field'] = 'picture';
|
||||
$handler->display->display_options['fields']['picture']['label'] = '';
|
||||
$handler->display->display_options['fields']['picture']['element_type'] = 'div';
|
||||
$handler->display->display_options['fields']['picture']['element_class'] = 'profile-badge-picture';
|
||||
$handler->display->display_options['fields']['picture']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['picture']['element_default_classes'] = FALSE;
|
||||
$handler->display->display_options['fields']['picture']['image_style'] = '50x50_avatar';
|
||||
/* 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;
|
||||
/* Field: User: Picture */
|
||||
$handler->display->display_options['fields']['picture']['id'] = 'picture';
|
||||
$handler->display->display_options['fields']['picture']['table'] = 'users';
|
||||
$handler->display->display_options['fields']['picture']['field'] = 'picture';
|
||||
$handler->display->display_options['fields']['picture']['label'] = '';
|
||||
$handler->display->display_options['fields']['picture']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['picture']['image_style'] = '50x50_avatar';
|
||||
$handler->display->display_options['fields']['name']['element_type'] = 'span';
|
||||
$handler->display->display_options['fields']['name']['element_class'] = 'profile-badge-name';
|
||||
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['name']['element_default_classes'] = FALSE;
|
||||
/* Sort criterion: Flags: Flagged time */
|
||||
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
|
||||
$handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content';
|
||||
|
37
modules/commons/commons_groups/commons_groups.commons.inc
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Commons module integration for the Commons Groups module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_commons_entity_integration().
|
||||
*/
|
||||
function commons_groups_commons_entity_integration() {
|
||||
return array(
|
||||
'node' => array(
|
||||
'group' => array(
|
||||
'is_group_content' => FALSE,
|
||||
'is_group' => TRUE,
|
||||
'exclude_commons_follow' => TRUE,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_commons_bw_group_widget().
|
||||
*/
|
||||
function commons_groups_commons_bw_group_widget() {
|
||||
return array(
|
||||
'commons_all' => array(
|
||||
'title' => t('All'),
|
||||
'type' => 'view',
|
||||
'vid' => 'commons_bw_all',
|
||||
'display' => 'default',
|
||||
'weight' => -10,
|
||||
'default' => 1,
|
||||
'bundle' => 'post',
|
||||
),
|
||||
);
|
||||
}
|
@ -4,6 +4,32 @@
|
||||
* commons_groups.features.inc
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_features_pipe_alter().
|
||||
*/
|
||||
function commons_groups_features_pipe_alter(&$pipe, $data, $export) {
|
||||
// Prevent Commons Groups related fields from being piped in features
|
||||
// when a content type includes those fields.
|
||||
if (!empty($pipe['field_instance'])) {
|
||||
foreach ($pipe['field_instance'] as $delta => $value) {
|
||||
$args = explode('-', $value);
|
||||
$field_name = $args[2];
|
||||
$excluded_fields = array('og_group_ref', 'field_og_access_default_value',
|
||||
'field_og_subscribe_settings', 'og_roles_permissions', 'group_access', 'field_group_logo', 'group_group', 'body');
|
||||
if (in_array($field_name, $excluded_fields)) {
|
||||
unset($pipe['field_instance'][$delta]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($pipe['field_base'])) {
|
||||
foreach ($pipe['field_base'] as $delta => $value) {
|
||||
if ($delta == 'og_group_ref') {
|
||||
unset($pipe['field_base'][$delta]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_plugin_api().
|
||||
*/
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* commons_groups.features.og_features_permission.inc
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_og_features_default_permissions().
|
||||
*/
|
||||
function commons_groups_og_features_default_permissions() {
|
||||
$permissions = array();
|
||||
|
||||
// Exported og permission: 'user:user:subscribe'
|
||||
$permissions['user:user:subscribe'] = array(
|
||||
'roles' => array(
|
||||
'non-member' => 'non-member',
|
||||
),
|
||||
);
|
||||
|
||||
// Exported og permission: 'user:user:subscribe without approval'
|
||||
$permissions['user:user:subscribe without approval'] = array(
|
||||
'roles' => array(),
|
||||
);
|
||||
|
||||
return $permissions;
|
||||
}
|
@ -45,6 +45,8 @@ features[field_instance][] = og_membership-og_membership_type_default-og_members
|
||||
features[image][] = 35x35
|
||||
features[image][] = 50x50
|
||||
features[node][] = group
|
||||
features[og_features_permission][] = user:user:subscribe
|
||||
features[og_features_permission][] = user:user:subscribe without approval
|
||||
features[user_permission][] = create group content
|
||||
features[user_permission][] = edit own group content
|
||||
features[variable][] = comment_anonymous_group
|
||||
@ -72,3 +74,10 @@ features[views_view][] = commons_groups_recent_content
|
||||
features[views_view][] = commons_groups_user_groups
|
||||
features_exclude[field][node-group-group_group] = node-group-group_group
|
||||
features_exclude[field][node-group-group_access] = node-group-group_access
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -210,3 +210,47 @@ function commons_groups_update_3116() {
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the title attribute with the title field in view displays.
|
||||
*/
|
||||
function commons_groups_update_3117() {
|
||||
$revert = array(
|
||||
'commons_groups' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert the contributors view to use new markup.
|
||||
*/
|
||||
function commons_groups_update_3118() {
|
||||
$revert = array(
|
||||
'commons_groups' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that permissions to subscribe to user groups are properly set.
|
||||
*/
|
||||
function commons_groups_update_3119() {
|
||||
$revert = array(
|
||||
'commons_groups' => array('og_features_permission'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert the group homepage view to use distinct to reduce duplicate entries.
|
||||
*/
|
||||
function commons_groups_update_3120() {
|
||||
$revert = array(
|
||||
'commons_groups' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
@ -10,16 +10,33 @@ include_once 'commons_groups.features.inc';
|
||||
* Implements hook_og_permission_alter().
|
||||
*/
|
||||
function commons_groups_og_permission_alter(&$perms) {
|
||||
// We set these values programatically based
|
||||
// on the value of field_og_subscribe_settings, so we disable them in the UI.
|
||||
$perms['subscribe']['roles'] = array();
|
||||
// Rename the 'subscribe' and 'subscribe without approval' permissions to
|
||||
// better reflect their purpose in Commons.
|
||||
$perms['subscribe']['title'] = t('Contribute to the group');
|
||||
$perms['subscribe']['description'] = t('This value is set automatically based on the "Group Privacy Settings" field.');
|
||||
$perms['subscribe without approval']['roles'] = array();
|
||||
$perms['subscribe without approval']['title'] = t('Contribute to the group without approval');
|
||||
$perms['subscribe without approval']['description'] = t('This value is set automatically based on the "Group Privacy Settings" field.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*
|
||||
* Hides permissions that are set automatically based on the "Group Privacy
|
||||
* Settings" field.
|
||||
*/
|
||||
function commons_groups_form_og_ui_admin_permissions_alter(&$form, &$form_state) {
|
||||
$hidden_permissions = array('subscribe', 'subscribe without approval');
|
||||
foreach ($hidden_permissions as $permission) {
|
||||
if (isset($form['permission'][$permission])) {
|
||||
$form['permission'][$permission]['#markup'] .= ' ' . t('<strong>Disabled by the Commons Groups module.<strong>');
|
||||
}
|
||||
foreach ($form['checkboxes'] as $index => $elements) {
|
||||
if (isset($elements['#options'][$permission])) {
|
||||
unset($form['checkboxes'][$index]['#options'][$permission]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_plugin_directory().
|
||||
@ -86,16 +103,30 @@ function commons_groups_entity_view($entity, $type, $view_mode, $langcode) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*
|
||||
* Alter the privacy settings fields.
|
||||
* Implements hook_form_BASE_FORM_ID_alter().
|
||||
*/
|
||||
function commons_groups_form_node_form_alter(&$form, &$form_state) {
|
||||
function commons_groups_form_node_form_alter(&$form, &$form_state, $form_id) {
|
||||
$node = $form['#node'];
|
||||
|
||||
list(, , $bundle) = entity_extract_ids('node', $node);
|
||||
|
||||
// Customizations to the node form for entities that are group content.
|
||||
$group_content_entity_types = commons_groups_get_group_content_entity_types();
|
||||
|
||||
if (isset($group_content_entity_types['node'][$bundle])) {
|
||||
$form['actions']['submit']['#submit'][] = 'commons_groups_node_in_group_submit';
|
||||
}
|
||||
|
||||
// Hide the "Group content visibility" field to simplify the node form.
|
||||
if (!empty($form['group_content_access']['#access'])) {
|
||||
$form['group_content_access']['#access'] = FALSE;
|
||||
}
|
||||
|
||||
// Alter the privacy settings fields.
|
||||
$groups = og_get_all_group_bundle();
|
||||
|
||||
if (isset($groups['node']) && in_array($form_state['node']->type, array_keys($groups['node']))) {
|
||||
if (isset($groups['node']) && in_array($bundle, array_keys($groups['node']))) {
|
||||
// The group privacy settings are not required.
|
||||
$form['field_og_subscribe_settings'][LANGUAGE_NONE]['#required'] = FALSE;
|
||||
|
||||
@ -111,9 +142,7 @@ function commons_groups_form_node_form_alter(&$form, &$form_state) {
|
||||
$form['#after_build'] = array('commons_groups_form_group_node_after_build');
|
||||
}
|
||||
|
||||
$form['#attached']['css'] = array(
|
||||
drupal_get_path('module', 'commons_groups') . '/css/commons_groups.css',
|
||||
);
|
||||
$form['#attached']['css'][] = drupal_get_path('module', 'commons_groups') . '/css/commons_groups.css';
|
||||
|
||||
// The group access is set on commons_groups_node_presave().
|
||||
$form['group_access'][LANGUAGE_NONE]['#required'] = FALSE;
|
||||
@ -210,64 +239,32 @@ function commons_groups_block_info() {
|
||||
'info' => t('"Create a group" call to action'),
|
||||
'cache' => DRUPAL_NO_CACHE,
|
||||
);
|
||||
|
||||
return $blocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_block_view().
|
||||
*/
|
||||
function commons_groups_block_view() {
|
||||
$block['subject'] = '';
|
||||
if (node_access('create', 'group')) {
|
||||
$block['content'] = l(t('Create a group'), 'node/add/group');
|
||||
}
|
||||
else {
|
||||
$block['content'] = '';
|
||||
function commons_groups_block_view($delta = '') {
|
||||
$block = array();
|
||||
|
||||
switch ($delta) {
|
||||
case 'commons_groups_create_group':
|
||||
if (node_access('create', 'group')) {
|
||||
$block['subject'] = NULL;
|
||||
$block['content'] = array(
|
||||
'#type' => 'link',
|
||||
'#title' => t('Create a group'),
|
||||
'#href' => 'node/add/group',
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_features_pipe_alter().
|
||||
*/
|
||||
function commons_groups_features_pipe_alter(&$pipe, $data, $export) {
|
||||
// Prevent Commons Groups related fields from being piped in features
|
||||
// when a content type includes those fields.
|
||||
if (!empty($pipe['field_instance'])) {
|
||||
foreach ($pipe['field_instance'] as $delta => $value) {
|
||||
$args = explode('-', $value);
|
||||
$field_name = $args[2];
|
||||
$excluded_fields = array('og_group_ref', 'field_og_access_default_value',
|
||||
'field_og_subscribe_settings', 'og_roles_permissions', 'group_access', 'field_group_logo', 'group_group', 'body');
|
||||
if (in_array($field_name, $excluded_fields)) {
|
||||
unset($pipe['field_instance'][$delta]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($pipe['field_base'])) {
|
||||
foreach ($pipe['field_base'] as $delta => $value) {
|
||||
if ($delta == 'og_group_ref') {
|
||||
unset($pipe['field_base'][$delta]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_commons_entity_integration().
|
||||
*/
|
||||
function commons_groups_commons_entity_integration() {
|
||||
return array(
|
||||
'node' => array(
|
||||
'group' => array(
|
||||
'is_group_content' => FALSE,
|
||||
'is_group' => TRUE,
|
||||
'exclude_commons_follow' => TRUE,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_pre_view().
|
||||
* By default, all views should have a group_type filter that looks at only nodes.
|
||||
@ -351,28 +348,6 @@ function commons_groups_form_alter(&$form, &$form_state, $form_id) {
|
||||
if ($form_id == 'group_node_form' && is_null($form['nid']['#value'])) {
|
||||
$form['actions']['submit']['#submit'][] = 'commons_groups_group_submission_message';
|
||||
}
|
||||
// Redirect the user back to the group homepage after submitting
|
||||
// a node within a group.
|
||||
if (isset($form['#node']) && substr($form_id, -10) == '_node_form') {
|
||||
// Hide the "Group content visibility" field to simplify the node form.
|
||||
if (!empty($form['group_content_access']['#access'])) {
|
||||
$form['group_content_access']['#access'] = FALSE;
|
||||
}
|
||||
// Set a human-friendly page title.
|
||||
if (empty($form['#node']->nid)) {
|
||||
$types = node_type_get_types();
|
||||
$type = $form['#node']->type;
|
||||
// Use 'a' or 'an' appropriately.
|
||||
$vowels = array('a', 'e', 'i', 'o', 'u');
|
||||
$verb = strtolower(in_array($type[0], $vowels)) ? 'Create an' : 'Create a';
|
||||
drupal_set_title(t("$verb @name", array('@name' => $types[$type]->name)), PASS_THROUGH);
|
||||
}
|
||||
// Customizations to the node form for entitites that are group content.
|
||||
$group_content_entity_types = commons_groups_get_group_content_entity_types();
|
||||
if (isset($group_content_entity_types['node'][$form['#node']->type])) {
|
||||
$form['actions']['submit']['#submit'][] = 'commons_groups_node_in_group_submit';
|
||||
}
|
||||
}
|
||||
if (in_array($form_id, array('og_ui_admin_global_permissions', 'og_ui_admin_permissions'))) {
|
||||
$group_content_entity_types = commons_groups_get_group_content_entity_types();
|
||||
if (!empty($group_content_entity_types)) {
|
||||
@ -836,9 +811,9 @@ function commons_groups_set_group_permissions($node) {
|
||||
/**
|
||||
* Returns an array of entity types that are enabled via Commons Groups.
|
||||
*/
|
||||
function commons_groups_get_group_content_entity_types() {
|
||||
function commons_groups_get_group_content_entity_types($cache = TRUE) {
|
||||
// Find all Commons Entity integrations.
|
||||
$commons_entity_integrations = commons_entity_integration_info();
|
||||
$commons_entity_integrations = commons_entity_integration_info(NULL, $cache);
|
||||
if (empty($commons_entity_integrations)) {
|
||||
return array();
|
||||
}
|
||||
@ -909,23 +884,6 @@ function commons_groups_first_contribution($account, $node) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_commons_bw_group_widget().
|
||||
*/
|
||||
function commons_groups_commons_bw_group_widget() {
|
||||
return array(
|
||||
'commons_all' => array(
|
||||
'title' => t('All'),
|
||||
'type' => 'view',
|
||||
'vid' => 'commons_bw_all',
|
||||
'display' => 'default',
|
||||
'weight' => -10,
|
||||
'default' => 1,
|
||||
'bundle' => 'post',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_node().
|
||||
*/
|
||||
@ -984,9 +942,9 @@ function commons_groups_preprocess_node(&$variables) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_views_view_grid().
|
||||
* Implements hook_preprocess_views_view_list().
|
||||
*/
|
||||
function commons_groups_preprocess_views_view_grid(&$variables, $hook) {
|
||||
function commons_groups_preprocess_views_view_list(&$variables, $hook) {
|
||||
// Change the displayed role name in the group contributors block to
|
||||
// "Organizers".
|
||||
if ($variables['view']->name == 'commons_contributors_group' && !empty($variables['title']) && $variables['title'] == 'administrator member') {
|
||||
@ -1161,3 +1119,58 @@ function commons_groups_views_pre_render(&$view) {
|
||||
$view->display_handler->handlers['empty']['area']->options['content'] = t('Nobody has posted yet.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Special Commons implementation of hook_features_rebuild().
|
||||
*
|
||||
* By default, reverting og permissions only occurs on the default rid, which is
|
||||
* 0. All groups already created will not see the new permissions.
|
||||
*
|
||||
* As an alternative, this function iterates through all of the groups and sets
|
||||
* default permissions and update the permissions map.
|
||||
*
|
||||
* @param string $module
|
||||
* The modules whose default user permissions should be rebuild.
|
||||
*/
|
||||
function commons_groups_features_permission_rebuild($module, $gid) {
|
||||
module_load_include('features.inc', 'og', '/includes/og_features_role');
|
||||
|
||||
if ($defaults = features_get_default('og_features_permission', $module)) {
|
||||
$grant = array();
|
||||
$revoke = array();
|
||||
|
||||
foreach ($defaults as $key => $details) {
|
||||
list($group_type, $bundle, $perm) = explode(':', $key);
|
||||
|
||||
// Make sure the role exists for this entity.
|
||||
foreach ($details['roles'] as $role) {
|
||||
$bundle_role = _og_features_role_exists($role, $group_type, $bundle);
|
||||
if (empty($bundle_role)) {
|
||||
og_role_save(og_role_create($role, $group_type, $gid, $bundle));
|
||||
}
|
||||
}
|
||||
|
||||
$roles = og_roles($group_type, $bundle, $gid);
|
||||
foreach ($roles as $rid => $rolename) {
|
||||
if (in_array($rolename, $details['roles'])) {
|
||||
$grant[$rid][] = $perm;
|
||||
}
|
||||
else {
|
||||
$revoke[$rid][] = $perm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($grant)) {
|
||||
foreach ($grant as $rid => $permissions) {
|
||||
og_role_grant_permissions($rid, $permissions);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($revoke)) {
|
||||
foreach ($revoke as $rid => $permissions) {
|
||||
og_role_revoke_permissions($rid, $permissions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['access']['type'] = 'perm';
|
||||
$handler->display->display_options['cache']['type'] = 'none';
|
||||
$handler->display->display_options['query']['type'] = 'views_query';
|
||||
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
|
||||
$handler->display->display_options['query']['options']['distinct'] = TRUE;
|
||||
$handler->display->display_options['exposed_form']['type'] = 'basic';
|
||||
$handler->display->display_options['pager']['type'] = 'lite';
|
||||
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
|
||||
@ -53,13 +53,19 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['relationships']['og_membership_rel']['table'] = 'node';
|
||||
$handler->display->display_options['relationships']['og_membership_rel']['field'] = 'og_membership_rel';
|
||||
$handler->display->display_options['relationships']['og_membership_rel']['required'] = TRUE;
|
||||
/* Relationship: Flags: commons_follow_node */
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['id'] = 'flag_content_rel';
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['table'] = 'node';
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['field'] = 'flag_content_rel';
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['ui_name'] = 'Following';
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['label'] = 'following';
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['required'] = 0;
|
||||
$handler->display->display_options['relationships']['flag_content_rel']['flag'] = 'commons_follow_node';
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Sort criterion: Content: Sticky */
|
||||
$handler->display->display_options['sorts']['sticky']['id'] = 'sticky';
|
||||
$handler->display->display_options['sorts']['sticky']['table'] = 'node';
|
||||
@ -72,6 +78,13 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
|
||||
$handler->display->display_options['sorts']['created']['exposed'] = TRUE;
|
||||
$handler->display->display_options['sorts']['created']['expose']['label'] = 'most recent';
|
||||
/* Sort criterion: Content: Radioactivity (field_radioactivity:radioactivity_energy) */
|
||||
$handler->display->display_options['sorts']['field_radioactivity_radioactivity_energy']['id'] = 'field_radioactivity_radioactivity_energy';
|
||||
$handler->display->display_options['sorts']['field_radioactivity_radioactivity_energy']['table'] = 'field_data_field_radioactivity';
|
||||
$handler->display->display_options['sorts']['field_radioactivity_radioactivity_energy']['field'] = 'field_radioactivity_radioactivity_energy';
|
||||
$handler->display->display_options['sorts']['field_radioactivity_radioactivity_energy']['order'] = 'DESC';
|
||||
$handler->display->display_options['sorts']['field_radioactivity_radioactivity_energy']['exposed'] = TRUE;
|
||||
$handler->display->display_options['sorts']['field_radioactivity_radioactivity_energy']['expose']['label'] = 'most active';
|
||||
/* Contextual filter: OG membership: Group ID */
|
||||
$handler->display->display_options['arguments']['gid']['id'] = 'gid';
|
||||
$handler->display->display_options['arguments']['gid']['table'] = 'og_membership';
|
||||
@ -94,7 +107,12 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['filters']['type']['id'] = 'type';
|
||||
$handler->display->display_options['filters']['type']['table'] = 'node';
|
||||
$handler->display->display_options['filters']['type']['field'] = 'type';
|
||||
$handler->display->display_options['filters']['type']['value'] = array();
|
||||
$handler->display->display_options['filters']['type']['value'] = array(
|
||||
'poll' => 'poll',
|
||||
'post' => 'post',
|
||||
'question' => 'question',
|
||||
'wiki' => 'wiki',
|
||||
);
|
||||
/* Filter criterion: OG membership: Group_type */
|
||||
$handler->display->display_options['filters']['group_type']['id'] = 'group_type';
|
||||
$handler->display->display_options['filters']['group_type']['table'] = 'og_membership';
|
||||
@ -103,6 +121,18 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['filters']['group_type']['value'] = array(
|
||||
'node' => 'node',
|
||||
);
|
||||
/* Filter criterion: Following */
|
||||
$handler->display->display_options['filters']['flagged']['id'] = 'flagged';
|
||||
$handler->display->display_options['filters']['flagged']['table'] = 'flag_content';
|
||||
$handler->display->display_options['filters']['flagged']['field'] = 'flagged';
|
||||
$handler->display->display_options['filters']['flagged']['relationship'] = 'flag_content_rel';
|
||||
$handler->display->display_options['filters']['flagged']['ui_name'] = 'Following';
|
||||
$handler->display->display_options['filters']['flagged']['value'] = '1';
|
||||
$handler->display->display_options['filters']['flagged']['exposed'] = TRUE;
|
||||
$handler->display->display_options['filters']['flagged']['expose']['operator_id'] = '';
|
||||
$handler->display->display_options['filters']['flagged']['expose']['label'] = 'Following';
|
||||
$handler->display->display_options['filters']['flagged']['expose']['operator'] = 'flagged_op';
|
||||
$handler->display->display_options['filters']['flagged']['expose']['identifier'] = 'following';
|
||||
$translatables['commons_bw_all'] = array(
|
||||
t('Master'),
|
||||
t('more'),
|
||||
@ -165,7 +195,19 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['fields']['picture']['table'] = 'users';
|
||||
$handler->display->display_options['fields']['picture']['field'] = 'picture';
|
||||
$handler->display->display_options['fields']['picture']['label'] = '';
|
||||
$handler->display->display_options['fields']['picture']['element_type'] = 'div';
|
||||
$handler->display->display_options['fields']['picture']['element_class'] = 'profile-badge-picture';
|
||||
$handler->display->display_options['fields']['picture']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['picture']['element_default_classes'] = FALSE;
|
||||
/* 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']['element_type'] = 'span';
|
||||
$handler->display->display_options['fields']['name']['element_class'] = 'profile-badge-name';
|
||||
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['name']['element_default_classes'] = FALSE;
|
||||
/* Sort criterion: User: Created date */
|
||||
$handler->display->display_options['sorts']['created']['id'] = 'created';
|
||||
$handler->display->display_options['sorts']['created']['table'] = 'users';
|
||||
@ -267,7 +309,7 @@ function commons_groups_views_default_views() {
|
||||
$handler = $view->new_display('panel_pane', 'group homepage', 'panel_pane_2');
|
||||
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'grid';
|
||||
$handler->display->display_options['style_plugin'] = 'list';
|
||||
$handler->display->display_options['style_options']['grouping'] = array(
|
||||
0 => array(
|
||||
'field' => 'og_roles',
|
||||
@ -275,9 +317,15 @@ function commons_groups_views_default_views() {
|
||||
'rendered_strip' => 0,
|
||||
),
|
||||
);
|
||||
$handler->display->display_options['style_options']['row_class'] = 'profile-badge';
|
||||
$handler->display->display_options['style_options']['default_row_class'] = FALSE;
|
||||
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
|
||||
$handler->display->display_options['style_options']['class'] = 'profile-badges clearfix';
|
||||
$handler->display->display_options['style_options']['wrapper_class'] = 'view-profile-badges';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'fields';
|
||||
$handler->display->display_options['row_options']['default_field_elements'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['fields'] = FALSE;
|
||||
/* Field: User: Picture */
|
||||
@ -285,7 +333,10 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['fields']['picture']['table'] = 'users';
|
||||
$handler->display->display_options['fields']['picture']['field'] = 'picture';
|
||||
$handler->display->display_options['fields']['picture']['label'] = '';
|
||||
$handler->display->display_options['fields']['picture']['element_type'] = 'div';
|
||||
$handler->display->display_options['fields']['picture']['element_class'] = 'profile-badge-picture';
|
||||
$handler->display->display_options['fields']['picture']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['picture']['element_default_classes'] = FALSE;
|
||||
$handler->display->display_options['fields']['picture']['image_style'] = '50x50';
|
||||
/* Field: OG membership: OG user roles in group */
|
||||
$handler->display->display_options['fields']['og_roles']['id'] = 'og_roles';
|
||||
@ -312,6 +363,18 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['defaults']['title'] = FALSE;
|
||||
$handler->display->display_options['title'] = 'Contributors to %1';
|
||||
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'list';
|
||||
$handler->display->display_options['style_options']['row_class'] = 'profile-badge';
|
||||
$handler->display->display_options['style_options']['default_row_class'] = FALSE;
|
||||
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
|
||||
$handler->display->display_options['style_options']['class'] = 'profile-badges';
|
||||
$handler->display->display_options['style_options']['wrapper_class'] = 'view-profile-badges';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'fields';
|
||||
$handler->display->display_options['row_options']['default_field_elements'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['path'] = 'node/%/contributors';
|
||||
$translatables['commons_contributors_group'] = array(
|
||||
t('Master'),
|
||||
@ -554,11 +617,11 @@ function commons_groups_views_default_views() {
|
||||
),
|
||||
);
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: User: Name */
|
||||
$handler->display->display_options['fields']['name']['id'] = 'name';
|
||||
$handler->display->display_options['fields']['name']['table'] = 'users';
|
||||
@ -765,11 +828,11 @@ function commons_groups_views_default_views() {
|
||||
),
|
||||
);
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: User: Name */
|
||||
$handler->display->display_options['fields']['name']['id'] = 'name';
|
||||
$handler->display->display_options['fields']['name']['table'] = 'users';
|
||||
@ -883,11 +946,11 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['empty']['area_text_custom']['content'] = 'All groups are updated. <a class="use-ajax" href="update/toggle">Remove group update message</a>';
|
||||
$handler->display->display_options['defaults']['fields'] = FALSE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: User: Name */
|
||||
$handler->display->display_options['fields']['name']['id'] = 'name';
|
||||
$handler->display->display_options['fields']['name']['table'] = 'users';
|
||||
@ -985,8 +1048,14 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['pager']['type'] = 'some';
|
||||
$handler->display->display_options['pager']['options']['items_per_page'] = '16';
|
||||
$handler->display->display_options['pager']['options']['offset'] = '0';
|
||||
$handler->display->display_options['style_plugin'] = 'grid';
|
||||
$handler->display->display_options['style_plugin'] = 'list';
|
||||
$handler->display->display_options['style_options']['row_class'] = 'profile-badge';
|
||||
$handler->display->display_options['style_options']['default_row_class'] = FALSE;
|
||||
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
|
||||
$handler->display->display_options['style_options']['class'] = 'profile-badges';
|
||||
$handler->display->display_options['style_options']['wrapper_class'] = 'view-profile-badges';
|
||||
$handler->display->display_options['row_plugin'] = 'fields';
|
||||
$handler->display->display_options['row_options']['default_field_elements'] = FALSE;
|
||||
/* No results behavior: Global: Text area */
|
||||
$handler->display->display_options['empty']['area']['id'] = 'area';
|
||||
$handler->display->display_options['empty']['area']['table'] = 'views';
|
||||
@ -1004,7 +1073,10 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['fields']['picture']['table'] = 'users';
|
||||
$handler->display->display_options['fields']['picture']['field'] = 'picture';
|
||||
$handler->display->display_options['fields']['picture']['label'] = '';
|
||||
$handler->display->display_options['fields']['picture']['element_type'] = 'div';
|
||||
$handler->display->display_options['fields']['picture']['element_class'] = 'profile-badge-picture';
|
||||
$handler->display->display_options['fields']['picture']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['picture']['element_default_classes'] = FALSE;
|
||||
$handler->display->display_options['fields']['picture']['image_style'] = '50x50';
|
||||
/* Sort criterion: User: Created date */
|
||||
$handler->display->display_options['sorts']['created']['id'] = 'created';
|
||||
@ -1091,12 +1163,11 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['empty']['area']['content'] = 'No groups have been created yet.';
|
||||
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Sort criterion: Content: Post date */
|
||||
$handler->display->display_options['sorts']['created']['id'] = 'created';
|
||||
$handler->display->display_options['sorts']['created']['table'] = 'node';
|
||||
@ -1207,14 +1278,13 @@ function commons_groups_views_default_views() {
|
||||
$handler->display->display_options['fields']['type']['exclude'] = TRUE;
|
||||
$handler->display->display_options['fields']['type']['element_label_colon'] = FALSE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['element_class'] = 'type-[type]';
|
||||
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['element_class'] = 'type-[type]';
|
||||
$handler->display->display_options['fields']['title_field']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Sort criterion: Content: Post date */
|
||||
$handler->display->display_options['sorts']['created']['id'] = 'created';
|
||||
$handler->display->display_options['sorts']['created']['table'] = 'node';
|
||||
@ -1314,12 +1384,13 @@ function commons_groups_views_default_views() {
|
||||
'image_link' => 'content',
|
||||
);
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['relationship'] = 'og_membership_related_node_group';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['relationship'] = 'og_membership_related_node_group';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Field: Field: Group */
|
||||
$handler->display->display_options['fields']['group_group']['id'] = 'group_group';
|
||||
$handler->display->display_options['fields']['group_group']['table'] = 'field_data_group_group';
|
||||
|
@ -3,7 +3,6 @@ description = The site-wide directory of groups
|
||||
core = 7.x
|
||||
package = Commons - Landing pages
|
||||
dependencies[] = commons_activity_streams_groups
|
||||
dependencies[] = commons_radioactivity_groups
|
||||
dependencies[] = ctools
|
||||
dependencies[] = page_manager
|
||||
dependencies[] = views_content
|
||||
@ -11,3 +10,10 @@ features[ctools][] = page_manager:pages_default:1
|
||||
features[ctools][] = views:views_default:3.0
|
||||
features[features_api][] = api:2
|
||||
features[page_manager_pages][] = groups_directory
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -5,3 +5,4 @@
|
||||
*/
|
||||
|
||||
include_once 'commons_groups_directory.features.inc';
|
||||
|
||||
|
@ -97,25 +97,6 @@ function commons_groups_directory_default_page_manager_pages() {
|
||||
$display->content['new-bf6c6f1b-08a6-3874-7186-c955c763c092'] = $pane;
|
||||
$display->panels['two_66_33_first'][0] = 'new-bf6c6f1b-08a6-3874-7186-c955c763c092';
|
||||
$pane = new stdClass();
|
||||
$pane->pid = 'new-ab237aa5-5ae7-8fb4-e1ce-20c776a6950b';
|
||||
$pane->panel = 'two_66_33_second';
|
||||
$pane->type = 'views_panes';
|
||||
$pane->subtype = 'commons_radioactivity_groups_most_active-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 = 'ab237aa5-5ae7-8fb4-e1ce-20c776a6950b';
|
||||
$display->content['new-ab237aa5-5ae7-8fb4-e1ce-20c776a6950b'] = $pane;
|
||||
$display->panels['two_66_33_second'][0] = 'new-ab237aa5-5ae7-8fb4-e1ce-20c776a6950b';
|
||||
$pane = new stdClass();
|
||||
$pane->pid = 'new-3db36521-fb53-58a4-c9e2-137a2dacee07';
|
||||
$pane->panel = 'two_66_33_top';
|
||||
$pane->type = 'block';
|
||||
|
@ -4,6 +4,30 @@
|
||||
* commons_groups_pages.features.inc
|
||||
*/
|
||||
|
||||
/*
|
||||
* Implements hook_features_pipe_alter().
|
||||
*/
|
||||
function commons_groups_pages_features_pipe_alter(&$pipe, $data, $export) {
|
||||
// Prevent Commons Groups related fields from being piped in features
|
||||
// when a content type includes those fields.
|
||||
if (!empty($pipe['panelizer_defaults'])) {
|
||||
|
||||
foreach ($pipe['panelizer_defaults'] as $delta => $value) {
|
||||
$args = explode(':', $value);
|
||||
$group_name = $args[1];
|
||||
|
||||
$group_bundles = og_get_all_group_bundle();
|
||||
if (isset($group_bundles['node']) && isset($group_bundles['node']['group'])) {
|
||||
unset($group_bundles['node']['group']);
|
||||
}
|
||||
$excluded_groups = array_keys($group_bundles);
|
||||
if (in_array($group_name, $excluded_groups)) {
|
||||
unset($pipe['field_instance'][$delta]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_plugin_api().
|
||||
*/
|
||||
|
@ -5,7 +5,6 @@ package = Commons - Landing pages
|
||||
dependencies[] = commons_activity_streams
|
||||
dependencies[] = commons_bw
|
||||
dependencies[] = commons_follow_group
|
||||
dependencies[] = commons_radioactivity_groups
|
||||
dependencies[] = ctools
|
||||
dependencies[] = panelizer
|
||||
dependencies[] = strongarm
|
||||
@ -15,3 +14,10 @@ features[features_api][] = api:2
|
||||
features[panelizer_defaults][] = node:group:default
|
||||
features[panelizer_defaults][] = node:group:default:teaser
|
||||
features[variable][] = panelizer_defaults_node_group
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -30,27 +30,3 @@ function commons_groups_pages_system_info_alter(&$info, $file, $type) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Implements hook_features_pipe_alter().
|
||||
*/
|
||||
function commons_groups_pages_features_pipe_alter(&$pipe, $data, $export) {
|
||||
// Prevent Commons Groups related fields from being piped in features
|
||||
// when a content type includes those fields.
|
||||
if (!empty($pipe['panelizer_defaults'])) {
|
||||
|
||||
foreach ($pipe['panelizer_defaults'] as $delta => $value) {
|
||||
$args = explode(':', $value);
|
||||
$group_name = $args[1];
|
||||
|
||||
$group_bundles = og_get_all_group_bundle();
|
||||
if (isset($group_bundles['node']) && isset($group_bundles['node']['group'])) {
|
||||
unset($group_bundles['node']['group']);
|
||||
}
|
||||
$excluded_groups = array_keys($group_bundles);
|
||||
if (in_array($group_name, $excluded_groups)) {
|
||||
unset($pipe['field_instance'][$delta]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -152,32 +152,6 @@ function commons_groups_pages_panelizer_defaults() {
|
||||
$display->content['new-a7009535-0e2a-2c94-edd2-4ecc953c4ca2'] = $pane;
|
||||
$display->panels['two_66_33_second'][1] = 'new-a7009535-0e2a-2c94-edd2-4ecc953c4ca2';
|
||||
$pane = new stdClass();
|
||||
$pane->pid = 'new-ba735f2b-4734-7724-098d-1925c6a4bb47';
|
||||
$pane->panel = 'two_66_33_second';
|
||||
$pane->type = 'views_panes';
|
||||
$pane->subtype = 'commons_radioactivity_groups_active_in_group-panel_pane_1';
|
||||
$pane->shown = TRUE;
|
||||
$pane->access = array();
|
||||
$pane->configuration = array(
|
||||
'arguments' => array(
|
||||
'gid' => '%node:nid',
|
||||
),
|
||||
'context' => array(
|
||||
0 => 'panelizer',
|
||||
),
|
||||
);
|
||||
$pane->cache = array();
|
||||
$pane->style = array(
|
||||
'settings' => NULL,
|
||||
);
|
||||
$pane->css = array();
|
||||
$pane->extras = array();
|
||||
$pane->position = 2;
|
||||
$pane->locks = array();
|
||||
$pane->uuid = 'ba735f2b-4734-7724-098d-1925c6a4bb47';
|
||||
$display->content['new-ba735f2b-4734-7724-098d-1925c6a4bb47'] = $pane;
|
||||
$display->panels['two_66_33_second'][2] = 'new-ba735f2b-4734-7724-098d-1925c6a4bb47';
|
||||
$pane = new stdClass();
|
||||
$pane->pid = 'new-52796f83-93dd-2cf4-41aa-33520dc31e5f';
|
||||
$pane->panel = 'two_66_33_second';
|
||||
$pane->type = 'views_panes';
|
||||
|
@ -43,3 +43,10 @@ features[image][] = commons-teaser-small-1_5x
|
||||
features[picture_mapping][] = commons_default
|
||||
features[picture_mapping][] = commons_full
|
||||
features[picture_mapping][] = commons_teaser
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -29,3 +29,10 @@ features[rules_config][] = rules_commons_kissmetrics_user_posts_comment
|
||||
features[rules_config][] = rules_commons_kissmetrics_user_registers
|
||||
features[rules_config][] = rules_commons_kissmetrics_user_replies_to_private_message_thread
|
||||
features[rules_config][] = rules_commons_kissmetrics_user_starts_new_private_message_thread
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -4,6 +4,16 @@
|
||||
* commons_like.features.inc
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_features_export_alter().
|
||||
*/
|
||||
function commons_like_features_export_alter(&$export, $module_name) {
|
||||
/* don't export strongarm anymore */
|
||||
if($module_name == 'commons_like' && isset($export['features']['variable'])) {
|
||||
unset($export['features']['variable']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_ctools_plugin_api().
|
||||
*/
|
||||
@ -24,7 +34,10 @@ function commons_like_default_message_type() {
|
||||
"argument_keys" : [],
|
||||
"argument" : [],
|
||||
"category" : "message_type",
|
||||
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
|
||||
"data" : {
|
||||
"token options" : { "clear" : 1 },
|
||||
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
|
||||
},
|
||||
"language" : "",
|
||||
"arguments" : null,
|
||||
"message_text" : { "und" : [
|
||||
|
@ -12,4 +12,10 @@ features[ctools][] = strongarm:strongarm:1
|
||||
features[features_api][] = api:2
|
||||
features[field_instance][] = message-commons_like_user_likes_node-field_target_nodes
|
||||
features[message_type][] = commons_like_user_likes_node
|
||||
features[variable][] = rate_widgets
|
||||
features[variable][] = rate_widgets
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -6,16 +6,6 @@
|
||||
|
||||
include_once 'commons_like.features.inc';
|
||||
|
||||
/**
|
||||
* Implements hook_features_export_alter().
|
||||
*/
|
||||
function commons_like_features_export_alter(&$export, $module_name) {
|
||||
/* don't export strongarm anymore */
|
||||
if($module_name == 'commons_like' && isset($export['features']['variable'])) {
|
||||
unset($export['features']['variable']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_strongarm_alter().
|
||||
*/
|
||||
|
@ -7,3 +7,10 @@ dependencies[] = features
|
||||
dependencies[] = field_sql_storage
|
||||
features[features_api][] = api:2
|
||||
features[field_base][] = field_address
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -22,3 +22,10 @@ features[variable][] = file_entity_file_upload_wizard_skip_fields
|
||||
features[variable][] = file_entity_file_upload_wizard_skip_file_type
|
||||
features[variable][] = file_entity_file_upload_wizard_skip_scheme
|
||||
features[variable][] = media_dialog_theme
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -140,7 +140,7 @@ function commons_media_page_build(&$page) {
|
||||
* Implements hook_filter_default_formats_alter().
|
||||
*/
|
||||
function commons_media_filter_default_formats_alter(&$formats) {
|
||||
if (module_exists('media_wysiwyg')) {
|
||||
if (module_exists('media_wysiwyg') && !empty($formats['filtered_html'])) {
|
||||
// Allow markup from remote media.
|
||||
$formats['filtered_html']['filters']['filter_html']['settings']['allowed_html'] = '<a> <em> <strong> <u> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h4> <h5> <h6> <p> <br> <img> <strike> <iframe></iframe>';
|
||||
|
||||
@ -158,7 +158,7 @@ function commons_media_filter_default_formats_alter(&$formats) {
|
||||
* Implements hook_ckeditor_profile_defaults().
|
||||
*/
|
||||
function commons_media_ckeditor_profile_defaults_alter(&$profiles) {
|
||||
if (module_exists('media_wysiwyg')) {
|
||||
if (module_exists('media_wysiwyg') && !empty($profiles['Advanced'])) {
|
||||
// Disable the advanced content filter.
|
||||
$profiles['Advanced']['settings']['allowed_content'] = 'f';
|
||||
|
||||
|
@ -24,3 +24,10 @@ features[variable][] = theme_adaptivetheme_settings
|
||||
features[variable][] = theme_commons_origins_settings
|
||||
features[variable][] = user_register
|
||||
features_exclude[dependencies][page_manager] = page_manager
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -27,3 +27,10 @@ features[variable][] = node_options_notice
|
||||
features[variable][] = node_preview_notice
|
||||
features[variable][] = node_submitted_notice
|
||||
features[views_view][] = commons_notices_latest_notices
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -45,12 +45,11 @@ function commons_notices_views_default_views() {
|
||||
$handler->display->display_options['relationships']['og_membership_rel']['field'] = 'og_membership_rel';
|
||||
$handler->display->display_options['relationships']['og_membership_rel']['required'] = TRUE;
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = FALSE;
|
||||
$handler->display->display_options['fields']['title_field']['id'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['table'] = 'field_data_title_field';
|
||||
$handler->display->display_options['fields']['title_field']['field'] = 'title_field';
|
||||
$handler->display->display_options['fields']['title_field']['label'] = '';
|
||||
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
||||
/* Sort criterion: Content: Post date */
|
||||
$handler->display->display_options['sorts']['created']['id'] = 'created';
|
||||
$handler->display->display_options['sorts']['created']['table'] = 'node';
|
||||
|
@ -24,7 +24,10 @@ function commons_notify_default_message_type() {
|
||||
"argument_keys" : [],
|
||||
"argument" : [],
|
||||
"category" : "commons_notify",
|
||||
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
|
||||
"data" : {
|
||||
"token options" : { "clear" : 1 },
|
||||
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
|
||||
},
|
||||
"language" : "",
|
||||
"arguments" : null,
|
||||
"message_text" : { "und" : [
|
||||
@ -49,7 +52,7 @@ function commons_notify_default_message_type() {
|
||||
"argument" : [],
|
||||
"category" : "commons_notify",
|
||||
"data" : {
|
||||
"token options" : { "clear" : 0 },
|
||||
"token options" : { "clear" : 1 },
|
||||
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
|
||||
},
|
||||
"language" : "",
|
||||
@ -75,7 +78,10 @@ function commons_notify_default_message_type() {
|
||||
"argument_keys" : [],
|
||||
"argument" : [],
|
||||
"category" : "commons_notify",
|
||||
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
|
||||
"data" : {
|
||||
"token options" : { "clear" : 1 },
|
||||
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
|
||||
},
|
||||
"language" : "",
|
||||
"arguments" : null,
|
||||
"message_text" : { "und" : [
|
||||
@ -99,7 +105,10 @@ function commons_notify_default_message_type() {
|
||||
"argument_keys" : [],
|
||||
"argument" : [],
|
||||
"category" : "commons_notify",
|
||||
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
|
||||
"data" : {
|
||||
"token options" : { "clear" : 1 },
|
||||
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
|
||||
},
|
||||
"language" : "",
|
||||
"arguments" : null,
|
||||
"message_text" : { "und" : [
|
||||
|
@ -48,3 +48,10 @@ features[variable][] = message_subscribe_default_notifiers
|
||||
features_exclude[field_base][message_text] = message_text
|
||||
features_exclude[field_base][field_target_nodes] = field_target_nodes
|
||||
features_exclude[field_base][field_target_comments] = field_target_comments
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -25,3 +25,10 @@ features[variable][] = node_options_page
|
||||
features[variable][] = node_preview_page
|
||||
features[variable][] = node_submitted_page
|
||||
features[variable][] = pathauto_node_page_pattern
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -16,10 +16,10 @@ function commons_pages_strongarm_alter(&$items) {
|
||||
foreach($items['rate_widgets']->value as $key => $widget) {
|
||||
if ($widget->name == 'commons_like') {
|
||||
if (!in_array('document', $items['rate_widgets']->value[$key]->node_types)) {
|
||||
$items['rate_widgets']->value[$key]->node_types[] = 'page';
|
||||
}
|
||||
$items['rate_widgets']->value[$key]->node_types[] = 'page';
|
||||
}
|
||||
if (!in_array('document', $items['rate_widgets']->value[$key]->comment_types)) {
|
||||
$items['rate_widgets']->value[$key]->comment_types[] = 'page';
|
||||
$items['rate_widgets']->value[$key]->comment_types[] = 'page';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
35
modules/commons/commons_polls/commons_polls.commons.inc
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Commons module integration for the Commons Polls module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_commons_entity_integration().
|
||||
*/
|
||||
function commons_polls_commons_entity_integration() {
|
||||
return array(
|
||||
'node' => array(
|
||||
'poll' => array(
|
||||
'media' => TRUE,
|
||||
'is_group_content' => TRUE,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_commons_bw_group_widget().
|
||||
*/
|
||||
function commons_polls_commons_bw_group_widget() {
|
||||
return array(
|
||||
'commons_polls' => array(
|
||||
'title' => t('Polls'),
|
||||
'type' => 'view',
|
||||
'vid' => 'commons_bw_polls',
|
||||
'display' => 'default',
|
||||
'weight' => 10,
|
||||
'bundle' => 'poll',
|
||||
),
|
||||
);
|
||||
}
|
@ -44,3 +44,10 @@ features[variable][] = node_options_poll
|
||||
features[variable][] = node_preview_poll
|
||||
features[variable][] = node_submitted_poll
|
||||
features[views_view][] = commons_bw_polls
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-06-25
|
||||
version = "7.x-3.15"
|
||||
core = "7.x"
|
||||
project = "commons"
|
||||
datestamp = "1403672628"
|
||||
|
||||
|
@ -1,5 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Set default polls roles upon enable
|
||||
*/
|
||||
function commons_polls_enable() {
|
||||
$revert = array(
|
||||
'commons_polls' => array('og_features_permission'),
|
||||
);
|
||||
features_revert($revert);
|
||||
|
||||
$groups = og_get_all_group();
|
||||
|
||||
foreach ($groups AS $gid) {
|
||||
commons_groups_features_permission_rebuild('commons_polls', $gid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable summary on Poll nodes.
|
||||
*/
|
||||
@ -65,3 +81,14 @@ function commons_polls_update_7005() {
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the title attribute with the title field in view displays.
|
||||
*/
|
||||
function commons_polls_update_7006() {
|
||||
$revert = array(
|
||||
'commons_polls' => array('views_view'),
|
||||
);
|
||||
features_revert($revert);
|
||||
return array();
|
||||
}
|
||||
|