From cbc238dad316711984e3b22fdc2bb54c247c12a2 Mon Sep 17 00:00:00 2001 From: Chris Gross <gross.364@osu.edu> Date: Thu, 27 Aug 2015 17:22:59 -0400 Subject: [PATCH] daily build --- profiles/wcm_base/CHANGELOG.txt | 6 + profiles/wcm_base/build-wcm_base-dev.make | 2 +- .../contrib/administerusersbyrole/PATCHES.txt | 4 + .../administerusersbyrole.info | 7 +- .../administerusersbyrole.install | 30 ++- .../administerusersbyrole.module | 155 +++++++++++--- ...sbyrole_handler_field_user_link_cancel.inc | 7 +- ...ersbyrole_handler_field_user_link_edit.inc | 9 +- .../workbench_moderation.admin.inc | 4 + .../workbench_moderation.module | 68 +++--- .../workbench_moderation.node.inc | 54 +++-- .../ocio_user_config/ocio_user_config.ds.inc | 15 +- .../ocio_user_config/ocio_user_config.make | 3 +- .../README.md | 0 .../wcm_user_contact.context.inc | 46 ++++ .../wcm_user_contact.features.field_base.inc} | 14 +- ..._user_contact.features.field_instance.inc} | 44 ++-- .../wcm_user_contact.features.inc | 21 ++ .../wcm_user_contact/wcm_user_contact.info | 19 ++ .../wcm_user_contact/wcm_user_contact.module | 7 + .../wcm_user_contact.views_default.inc | 202 ++++++++++++++++++ .../wcm_user_directory.features.inc | 21 -- .../wcm_user_directory.info | 18 -- .../wcm_user_directory.module | 7 - .../wcm_user_directory.views_default.inc | 100 --------- ...cm_user_leadership.features.field_base.inc | 4 +- ...ser_leadership.features.field_instance.inc | 4 +- .../wcm_user_leadership.info | 1 + .../wcm_user_profile/wcm_user_profile.ds.inc | 34 +-- ...m_user_profile.features.field_instance.inc | 34 +-- .../wcm_user_profile/wcm_user_profile.module | 4 +- .../wcm_user_profile.strongarm.inc | 11 +- profiles/wcm_base/wcm_base.info | 2 +- profiles/wcm_base/wcm_base.make | 10 +- 34 files changed, 647 insertions(+), 320 deletions(-) create mode 100644 profiles/wcm_base/modules/contrib/administerusersbyrole/PATCHES.txt rename profiles/wcm_base/modules/custom/{wcm_user_directory => wcm_user_contact}/README.md (100%) create mode 100644 profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.context.inc rename profiles/wcm_base/modules/custom/{wcm_user_directory/wcm_user_directory.features.field_base.inc => wcm_user_contact/wcm_user_contact.features.field_base.inc} (63%) rename profiles/wcm_base/modules/custom/{wcm_user_directory/wcm_user_directory.features.field_instance.inc => wcm_user_contact/wcm_user_contact.features.field_instance.inc} (54%) create mode 100644 profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.features.inc create mode 100644 profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.info create mode 100644 profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.module create mode 100644 profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.views_default.inc delete mode 100644 profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.features.inc delete mode 100644 profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.info delete mode 100644 profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.module delete mode 100644 profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.views_default.inc diff --git a/profiles/wcm_base/CHANGELOG.txt b/profiles/wcm_base/CHANGELOG.txt index 193e5a69..2f6fd634 100644 --- a/profiles/wcm_base/CHANGELOG.txt +++ b/profiles/wcm_base/CHANGELOG.txt @@ -1,3 +1,9 @@ +WCM Base 7.x-1.x, pending +---------------------------- +- OCIO User Config: Upgrade and patch Administer Users By Role module to fix + AJAX error when non-administrator adds photo while creating new user. +- OCIO User Contact: Added user contact page fields and pages. + WCM Base 7.x-1.x, 2015-08-24 ---------------------------- - Drupal: Updated to 7.39 security release diff --git a/profiles/wcm_base/build-wcm_base-dev.make b/profiles/wcm_base/build-wcm_base-dev.make index 9a2dacd2..272439c5 100644 --- a/profiles/wcm_base/build-wcm_base-dev.make +++ b/profiles/wcm_base/build-wcm_base-dev.make @@ -41,7 +41,7 @@ projects[ocio_workbench][options][working-copy] = TRUE projects[ocio_wysiwyg][options][working-copy] = TRUE projects[wcm_front_page][options][working-copy] = TRUE projects[wcm_tile_panes][options][working-copy] = TRUE -projects[wcm_user_directory][options][working-copy] = TRUE +projects[wcm_user_contact][options][working-copy] = TRUE projects[wcm_user_leadership][options][working-copy] = TRUE projects[wcm_user_profile][options][working-copy] = TRUE diff --git a/profiles/wcm_base/modules/contrib/administerusersbyrole/PATCHES.txt b/profiles/wcm_base/modules/contrib/administerusersbyrole/PATCHES.txt new file mode 100644 index 00000000..85feeab4 --- /dev/null +++ b/profiles/wcm_base/modules/contrib/administerusersbyrole/PATCHES.txt @@ -0,0 +1,4 @@ +The following patches have been applied to this project: +- http://drupal.org/files/issues/administerusersbyrole-can_create_user_ajax_submit-2557473-13-D7.patch + +This file was automatically generated by Drush Make (http://drupal.org/project/drush). \ No newline at end of file diff --git a/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.info b/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.info index 7a70f4eb..71d273a6 100644 --- a/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.info +++ b/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.info @@ -1,13 +1,14 @@ name = Administer Users by Role description = "Allows users with 'administer users' permission and a role (specified in 'Permissions') to edit/delete other users with a specified role. Also provides control over user creation." +dependencies[] = chain_menu_access core = 7.x files[] = administerusersbyrole.test files[] = views/administerusersbyrole_handler_field_user_link_edit.inc files[] = views/administerusersbyrole_handler_field_user_link_cancel.inc -; Information added by Drupal.org packaging script on 2014-11-25 -version = "7.x-2.0-beta1" +; Information added by Drupal.org packaging script on 2015-07-28 +version = "7.x-2.0-rc1" core = "7.x" project = "administerusersbyrole" -datestamp = "1416955681" +datestamp = "1438069740" diff --git a/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.install b/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.install index c673ae46..8d008f35 100644 --- a/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.install +++ b/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.install @@ -5,11 +5,22 @@ * Update migration code for administerusersbyrole. */ +/** + * Implementation of hook_install(). + */ +function administerusersbyrole_install() { + // We need to run after various other modules + // - After entity so that our hook_entity_info_alter is used. + // - After admin_views else due to a bug (https://www.drupal.org/node/2425121) it will break menu access settings. + // - After any other access modules so that our hook_menu_alter is used, as we will try harder than most modules + // to take account of other module's settings. + db_query("UPDATE {system} SET weight = 25 WHERE name = 'administerusersbyrole'"); +} + /** * Update permissions to match the new values used in version 2. */ -function administerusersbyrole_update_7200() -{ +function administerusersbyrole_update_7200() { $roles = user_roles(TRUE); foreach ($roles as $rid => $role) { // Rename permissions from old value to new. @@ -42,6 +53,21 @@ function administerusersbyrole_update_7200() return t('Role permissions updated for upgrade to Administer Users by Role version 2. Please check the new permissions are correct, in particular for "administer users".'); } +/** + * Update module weight and add dependency on chain_menu_access. + */ +function administerusersbyrole_update_7201() { + db_query("UPDATE {system} SET weight = 25 WHERE name = 'administerusersbyrole'"); + + // Enable new dependencies. + if (!module_enable(array('chain_menu_access'))) { + throw new DrupalUpdateException('To use latest version of "Administer Users by Role", please download the "Chain Menu Access API" module.'); + } + + // Rebuild menus using chain_menu_access. + menu_rebuild(); +} + /** * Generates a permission string for a given a role name. */ diff --git a/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.module b/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.module index bf3aac36..6daca0f6 100644 --- a/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.module +++ b/profiles/wcm_base/modules/contrib/administerusersbyrole/administerusersbyrole.module @@ -35,54 +35,97 @@ function administerusersbyrole_permission() { return $perms; } +/** + * Implements hook_init(). + */ +function administerusersbyrole_init() { + + // The code in the user module to create a user relies on 'administer users' permission being set. + // We do alter this on the menu 'admin/people/create', but we also need to set this permission, when + // a register form is submitted for example by ajax (callback 'system/ajax' is used). + if (isset($_POST['form_build_id'])) { + $form_state = form_state_defaults(); + $form = form_get_cache($_POST['form_build_id'], $form_state); + + if (is_array($form) && $form['#form_id'] == 'user_register_form') { + _administerusersbyrole_can_create_users('elevate'); + } + } +} + /** * Implements hook_menu_alter(). */ function administerusersbyrole_menu_alter(&$items) { - $items['user/%user']['access callback'] = '_administerusersbyrole_can_view_user'; - $items['user/%user']['access arguments'] = array(1); - $items['user/%user/edit']['access callback'] = '_administerusersbyrole_can_edit_user'; - $items['user/%user/edit']['access arguments'] = array(1); - $items['user/%user/cancel']['access callback'] = '_administerusersbyrole_can_cancel_user'; - $items['user/%user/cancel']['access arguments'] = array(1); + // Dependency was added on chain_menu_access and, immediately after an update, the dependency may be missing. + // Make sure we don't render the whole website unusable in this case. + if (!module_exists('chain_menu_access')) { + return; + } + chain_menu_access_chain($items, 'user/%user', '_administerusersbyrole_check_access', array(1, 'edit'), TRUE); + chain_menu_access_chain($items, 'user/%user/edit', '_administerusersbyrole_check_access', array(1, 'edit'), TRUE); + chain_menu_access_chain($items, 'user/%user/cancel', '_administerusersbyrole_check_access', array(1, 'cancel'), TRUE); $items['user/%user/cancel']['page callback'] = 'administerusersbyrole_cancel_confirm_wrapper'; $items['user/%user/cancel']['page arguments'] = array(1); - $items['admin/people']['access callback'] = '_administerusersbyrole_can_admin_people'; - $items['admin/people/people']['access callback'] = '_administerusersbyrole_can_admin_people'; - $items['admin/people/create']['access callback'] = '_administerusersbyrole_can_create_users'; + chain_menu_access_chain($items, 'admin/people', 'user_access', array('access users overview'), TRUE); // The code in the user module to create a user relies on 'administer users' permission being set, so pass an argument to elevate permissions. - $items['admin/people/create']['access arguments'] = array('elevate'); + chain_menu_access_chain($items, 'admin/people/create', '_administerusersbyrole_can_create_users', array('elevate'), TRUE); } /** - * Determine access to the admin/people page. + * Implements hook_module_implements_alter(). + * + * We need to be after the call from the entity module so our hook takes precedence. */ -function _administerusersbyrole_can_admin_people() { - // Access by this module permission or the one from the user module. - return user_access('access users overview') || user_access('administer users'); +function administerusersbyrole_module_implements_alter(&$implementations, $hook) { + if ($hook == 'entity_info_alter') { + // Move our hook implementation to the bottom. + $group = $implementations['administerusersbyrole']; + unset($implementations['administerusersbyrole']); + $implementations['administerusersbyrole'] = $group; + } } /** - * Determine access to view the specified user account. + * Implements hook_views_default_views_alter(). */ -function _administerusersbyrole_can_view_user($account) { - return user_view_access($account) || _administerusersbyrole_can_edit_user($account); +function administerusersbyrole_views_default_views_alter(&$views) { + if (isset($views['admin_views_user'])) { + // Add a tag to the admin_views module users view. + $handler =& $views['admin_views_user']->display['default']->handler; + $handler->display->display_options['query']['options']['query_tags'] = array('administerusersbyrole_edit_access'); + } } /** - * Determine access to edit the specified user account. + * Implements hook_query_alter(). */ -function _administerusersbyrole_can_edit_user($account) { - return user_edit_access($account) || _administerusersbyrole_check_access($account, 'edit'); -} +function administerusersbyrole_query_alter(QueryAlterableInterface $query) { + // The tag administerusersbyrole_edit_access is used to indicate that we should filter out users where there isn't edit access. + if ($query->hasTag('administerusersbyrole_edit_access') && !user_access('administer users')) { + // Exclude the root user. + $query->condition('users.uid', 1, '<>'); + + $roles = user_roles(TRUE); + foreach ($roles as $rid => $role) { + if (!user_access(_administerusersbyrole_build_perm_string($rid, 'edit'))) { + $exclude[$rid] = $rid; + } + } + + if (isset($exclude[DRUPAL_AUTHENTICATED_RID])) { + // No permission unless there is a role. + $query->join('users_roles', 'users_roles_2', 'users_roles_2.uid=users.uid'); + unset($exclude[DRUPAL_AUTHENTICATED_RID]); + } -/** - * Determine access to cancel the specified user account. - */ -function _administerusersbyrole_can_cancel_user($account) { - return user_cancel_access($account) || _administerusersbyrole_check_access($account, 'cancel'); + // Do an "anti-join" on the excluded roles - add a left join and then check the results set is null. + // NB We don't have to check that $exclude might be empty, because it always contains the admin role. + $query->leftjoin('users_roles', 'users_roles', 'users_roles.uid=users.uid AND users_roles.rid IN (:exclude)', array(':exclude' => $exclude)); + $query->isNull('users_roles.uid'); + } } - + /** * Determine access to create user accounts. */ @@ -93,8 +136,7 @@ function _administerusersbyrole_can_create_users($extra = '') { } return TRUE; } - - return user_access('administer users'); + return FALSE; } /** @@ -180,13 +222,64 @@ function administerusersbyrole_form_user_profile_form_alter(&$form, &$form_state } } +/** + * Implements hook_entity_info_alter(). + */ +function administerusersbyrole_entity_info_alter(&$entity_info) { + $entity_info['user']['access callback'] = 'administerusersbyrole_metadata_user_access'; +} + +/** + * Implements hook_entity_property_info_alter(). + */ +function administerusersbyrole_entity_property_info_alter(&$info) { + $properties = &$info['user']['properties']; + $properties['name']['access callback'] = 'administerusersbyrole_metadata_user_properties_access'; + $properties['mail']['access callback'] = 'administerusersbyrole_metadata_user_properties_access'; + $properties['status']['access callback'] = 'administerusersbyrole_metadata_user_properties_access'; + $properties['theme']['access callback'] = 'administerusersbyrole_metadata_user_properties_access'; +} + +/** + * Access callback for the user entity. + */ +function administerusersbyrole_metadata_user_access($op, $account = NULL, $check_as = NULL) { + // Call the base function. + if (entity_metadata_user_access($op, $account, $check_as)) { + return TRUE; + } + + $convert = array('delete' => 'cancel', 'update' => 'edit'); + $op = $convert{$op}; + + if (isset($op)) { + // Call our own function. + $check_as = isset($check_as) ? $check_as : $GLOBALS['user']; + return _administerusersbyrole_check_access($account, $op, $check_as); + } + return FALSE; +} + +/** + * Access callback for user entity properties. + */ +function administerusersbyrole_metadata_user_properties_access($op, $property, $account = NULL, $check_as = NULL) { + // Call the base function. + if (entity_metadata_user_properties_access($op, $property, $account, $check_as)) { + return TRUE; + } + + $check_as = isset($check_as) ? $check_as : $GLOBALS['user']; + return _administerusersbyrole_check_access($account, 'edit', $check_as); +} + /** * Check access to perform an operation on an account. * * This function checks the permissions of this module only. The calling code needs * to check any Drupal core permissions that should also allow access. */ -function _administerusersbyrole_check_access($account, $op) { +function _administerusersbyrole_check_access($account, $op, $check_as = NULL) { // Never allow uid 0 (anonymous) or 1 (master admin). if ($account->uid <= 1) { return FALSE; @@ -203,7 +296,7 @@ function _administerusersbyrole_check_access($account, $op) { if (($rid === DRUPAL_AUTHENTICATED_RID) && (count($account->roles) > 1)) { continue; } - if (!user_access(_administerusersbyrole_build_perm_string($rid, $op))) { + if (!user_access(_administerusersbyrole_build_perm_string($rid, $op), $check_as)) { return FALSE; } } diff --git a/profiles/wcm_base/modules/contrib/administerusersbyrole/views/administerusersbyrole_handler_field_user_link_cancel.inc b/profiles/wcm_base/modules/contrib/administerusersbyrole/views/administerusersbyrole_handler_field_user_link_cancel.inc index b7e24dc7..236e986f 100644 --- a/profiles/wcm_base/modules/contrib/administerusersbyrole/views/administerusersbyrole_handler_field_user_link_cancel.inc +++ b/profiles/wcm_base/modules/contrib/administerusersbyrole/views/administerusersbyrole_handler_field_user_link_cancel.inc @@ -17,11 +17,10 @@ class administerusersbyrole_handler_field_user_link_cancel extends views_handler function render_link($data, $values) { $uid = $values->{$this->aliases['uid']}; - // Build a pseudo account object to be able to check the access. - $account = new stdClass(); - $account->uid = $uid; + // Pull the access information from the menu router item. + $item = menu_get_item("user/$uid/cancel"); - if ($uid && _administerusersbyrole_can_cancel_user($account)) { + if ($item['access']) { $this->options['alter']['make_link'] = TRUE; $text = !empty($this->options['text']) ? $this->options['text'] : t('Cancel account'); diff --git a/profiles/wcm_base/modules/contrib/administerusersbyrole/views/administerusersbyrole_handler_field_user_link_edit.inc b/profiles/wcm_base/modules/contrib/administerusersbyrole/views/administerusersbyrole_handler_field_user_link_edit.inc index 7accdf8c..66c08739 100644 --- a/profiles/wcm_base/modules/contrib/administerusersbyrole/views/administerusersbyrole_handler_field_user_link_edit.inc +++ b/profiles/wcm_base/modules/contrib/administerusersbyrole/views/administerusersbyrole_handler_field_user_link_edit.inc @@ -8,17 +8,16 @@ /** * Field handler to present a link to user edit. * - * Identical to the base class except change call to user_edit_access() for _administerusersbyrole_can_edit_user(). + * Identical to the base class except change call to user_edit_access() for our updated access function. * * @ingroup views_field_handlers */ class administerusersbyrole_handler_field_user_link_edit extends views_handler_field_user_link_edit { function render_link($data, $values) { - // Build a pseudo account object to be able to check the access. - $account = new stdClass(); - $account->uid = $data; + // Pull the access information from the menu router item. + $item = menu_get_item("user/$data/edit"); - if ($data && _administerusersbyrole_can_edit_user($account)) { + if ($item['access']) { $this->options['alter']['make_link'] = TRUE; $text = !empty($this->options['text']) ? $this->options['text'] : t('edit'); diff --git a/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.admin.inc b/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.admin.inc index 003cd5ca..7121c47c 100644 --- a/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.admin.inc +++ b/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.admin.inc @@ -150,6 +150,10 @@ function workbench_moderation_admin_states_form_submit($form, &$form_state) { 'weight' => $info['weight'], ); workbench_moderation_state_save($state); + if (module_exists('i18n_string')) { + i18n_string_update(array('workbench_moderation', 'moderation_state', $info['name'], 'label'), $info['label']); + i18n_string_update(array('workbench_moderation', 'moderation_state', $info['name'], 'description'), $info['description']); + } } } diff --git a/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.module b/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.module index b2a32e4d..b2850064 100644 --- a/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.module +++ b/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.module @@ -186,14 +186,15 @@ function workbench_moderation_menu_alter(&$items) { $items['node/%node/revisions']['page arguments'] = array(1); // Override the node revision view callback. - $items['node/%node/revisions/%/view']['page callback'] = 'workbench_moderation_node_view_revision'; - $items['node/%node/revisions/%/view']['file path'] = drupal_get_path('module', 'workbench_moderation'); - $items['node/%node/revisions/%/view']['file'] = 'workbench_moderation.node.inc'; - + $items['node/%node/revisions/%/view']['page callback'] = 'workbench_moderation_node_view_revision'; + $items['node/%node/revisions/%/view']['file path'] = drupal_get_path('module', 'workbench_moderation'); + $items['node/%node/revisions/%/view']['file'] = 'workbench_moderation.node.inc'; // For revert and delete operations, use our own access check. $items['node/%node/revisions/%/revert']['access callback'] = '_workbench_moderation_revision_access'; + $items['node/%node/revisions/%/revert']['access arguments'] = array(1, 'update'); $items['node/%node/revisions/%/delete']['access callback'] = '_workbench_moderation_revision_access'; + $items['node/%node/revisions/%/delete']['access arguments'] = array(1, 'delete'); // Provide a container administration menu item, if one doesn't already exist. if (!isset($items['admin/config/workbench'])) { @@ -527,27 +528,8 @@ function _workbench_moderation_revision_access($node, $op) { } } - // Temporarily give the node an impossible revision. - // _node_revision_access() keeps access check results in a static variable - // indexed by revision only, not by op. Thus, subsequent checks on the same - // vid for different ops yield the same result, regardless of permissions. - // Setting a fake vid here allows us to store different static results per op. - $tmp = $node->vid; - switch ($op) { - case 'update': - $node->vid = -1; - break; - case 'delete': - $node->vid = -2; - break; - } - // Check access. - $access = _node_revision_access($node, $op); - - // Restore the original revision id. - $node->vid = $tmp; - return $access; + return _node_revision_access($node, $op); } /** @@ -1354,13 +1336,49 @@ function workbench_moderation_state_labels() { if (!isset($labels)) { $labels = array(); foreach (workbench_moderation_states() as $machine_name => $state) { - $labels[$machine_name] = $state->label; + if (module_exists('i18n_string')) { + $labels[$machine_name] = i18n_string_translate(array('workbench_moderation', 'moderation_state', $machine_name, 'label'), $state->label); + } + else { + $labels[$machine_name] = $state->label; + } } } return $labels; } +/** + * Implements hook_i18n_string_info(). + */ +function workbench_moderation_i18n_string_info() { + $groups['workbench_moderation'] = array( + 'title' => t('Workbench moderation'), + 'description' => t('Translatable workbench moderation states: label.'), + // This group doesn't have strings with format. + 'format' => FALSE, + // This group can list all strings. + 'list' => TRUE, + ); + return $groups; +} + +/** + * Implements hook_i18n_string_list(). + */ +function workbench_moderation_i18n_string_list($group) { + $strings = array(); + + if ($group == 'workbench_moderation') { + foreach (workbench_moderation_states() as $state) { + $strings['workbench_moderation']['moderation_state'][$state->name]['label'] = $state->label; + $strings['workbench_moderation']['moderation_state'][$state->name]['description'] = $state->description; + } + } + + return $strings; +} + /** * Get the label for a state based on its machine name. * diff --git a/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.node.inc b/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.node.inc index efe9c4af..a5f68629 100644 --- a/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.node.inc +++ b/profiles/wcm_base/modules/contrib/workbench_moderation/workbench_moderation.node.inc @@ -83,14 +83,15 @@ function workbench_moderation_node_history_view($node) { drupal_set_title(t('History of %title', array('%title' => $node->title)), PASS_THROUGH); // Get all of the node revisions, each with its most recent moderation. - $query = db_select('node', 'n'); + $query = db_select('node', 'n')->extend('PagerDefault'); $query->leftJoin('node_revision', 'r', 'n.nid = r.nid'); $query->leftJoin('users', 'u', 'r.uid = u.uid'); $query->addField('n', 'vid', 'live_revision'); $query->condition('n.nid', $node->nid) ->orderBy('r.vid', 'DESC') ->fields('r', array('nid', 'vid', 'title', 'log', 'uid', 'timestamp')) - ->fields('u', array('name')); + ->fields('u', array('name')) + ->limit(30); $revisions = $query->execute() ->fetchAllAssoc('vid'); @@ -129,14 +130,36 @@ function workbench_moderation_node_history_view($node) { // Revision operations. $revision_operations = array(); - if (isset($node->workbench_moderation['published']) && $revision->vid == $node->workbench_moderation['published']->vid) { - $revision_operations['view'] = workbench_moderation_access_link(t('View'), "node/{$revision->nid}"); - } - elseif ($revision->vid == $node->workbench_moderation['current']->vid) { - $revision_operations['view'] = workbench_moderation_access_link(t('View'), "node/{$revision->nid}/current-revision"); + + // Loading the node at the specific revision using node_load() is too slow + // when there are many revisions, thus we fake it by cloning the original + // node and changing the 'vid' and the 'my_revision' elements required for + // granting access to the revision operations (view, update/revert, delete). + $node_revision = clone $node; + $node_revision->vid = $revision->vid; + $node_revision->workbench_moderation['my_revision'] = $revision; + + // View operation. + if (_workbench_moderation_revision_access($node_revision, 'view')) { + // Link to the node page if this is the published revision. + if (isset($node->workbench_moderation['published']) && $revision->vid == $node->workbench_moderation['published']->vid) { + $url = "node/{$revision->nid}"; + } + // The special case "current-revision" link handles routing for the + // current unpublished revision. + elseif ($revision->vid == $node->workbench_moderation['current']->vid) { + $url = "node/{$revision->nid}/current-revision"; + } + // Otherwise, link to the normal revision view page. + else { + $url = "node/{$revision->nid}/revisions/{$revision->vid}/view"; + } + $revision_operations['view'] = l(t('View'), $url); } - else { - $revision_operations['view'] = workbench_moderation_access_link(t('View'), "node/{$revision->nid}/revisions/{$revision->vid}/view"); + + // Revert operation. + if (_workbench_moderation_revision_access($node_revision, 'update')) { + $revision_operations['revert'] = l(t('Revert'), "node/{$revision->nid}/revisions/{$revision->vid}/revert"); } // Provide a courtesy edit operation if this is the current revision. @@ -154,8 +177,10 @@ function workbench_moderation_node_history_view($node) { $revision_operations['edit'] = l($edit_operation_title, "node/{$revision->nid}/edit", array('query' => array('destination' => "node/{$revision->nid}/moderation"))); } - $revision_operations['revert'] = workbench_moderation_access_link(t('Revert'), "node/{$revision->nid}/revisions/{$revision->vid}/revert"); - $revision_operations['delete'] = workbench_moderation_access_link(t('Delete'), "node/{$revision->nid}/revisions/{$revision->vid}/delete"); + // Delete operation. + if (_workbench_moderation_revision_access($node_revision, 'delete')) { + $revision_operations['delete'] = l(t('Delete'), "node/{$revision->nid}/revisions/{$revision->vid}/delete"); + } $row['data']['revision'] = implode(' | ', array_filter($revision_operations)); @@ -236,7 +261,7 @@ function workbench_moderation_node_history_view($node) { $header = array(t('Revision'), t('Title'), t('Date'), t('Revision actions'), t('Moderation actions')); // Return properly styled output. - return array( + $build['pager_table'] = array( '#attached' => array( 'css' => array( drupal_get_path('module', 'workbench_moderation') . '/css/workbench_moderation.css', @@ -246,6 +271,11 @@ function workbench_moderation_node_history_view($node) { '#header' => $header, '#rows' => $rows, ); + + // Attach the pager theme. + $build['pager_pager'] = array('#theme' => 'pager'); + + return $build; } /** diff --git a/profiles/wcm_base/modules/custom/ocio_user_config/ocio_user_config.ds.inc b/profiles/wcm_base/modules/custom/ocio_user_config/ocio_user_config.ds.inc index 4267fc0b..45729782 100644 --- a/profiles/wcm_base/modules/custom/ocio_user_config/ocio_user_config.ds.inc +++ b/profiles/wcm_base/modules/custom/ocio_user_config/ocio_user_config.ds.inc @@ -27,10 +27,11 @@ function ocio_user_config_ds_layout_settings_info() { 4 => 'summary', 5 => 'field_room_and_building', 6 => 'field_street_address', - 7 => 'field_display_in_directory', + 7 => 'field_display_on_contact_page', 8 => 'field_display_in_leadership_list', 9 => 'field_first_name', 10 => 'field_last_name', + 11 => 'ds_user_picture', ), ), 'fields' => array( @@ -41,17 +42,21 @@ function ocio_user_config_ds_layout_settings_info() { 'summary' => 'ds_content', 'field_room_and_building' => 'ds_content', 'field_street_address' => 'ds_content', - 'field_display_in_directory' => 'ds_content', + 'field_display_on_contact_page' => 'ds_content', 'field_display_in_leadership_list' => 'ds_content', 'field_first_name' => 'ds_content', 'field_last_name' => 'ds_content', + 'ds_user_picture' => 'ds_content', ), 'classes' => array(), - 'wrappers' => array(), + 'wrappers' => array( + 'ds_content' => 'div', + 'ds_hidden' => 'div', + ), 'layout_wrapper' => 'div', 'layout_attributes' => '', - 'layout_attributes_merge' => TRUE, - 'layout_link_attribute' => FALSE, + 'layout_attributes_merge' => 1, + 'layout_link_attribute' => '', 'layout_link_custom' => '', ); $export['user|user|default'] = $ds_layout; diff --git a/profiles/wcm_base/modules/custom/ocio_user_config/ocio_user_config.make b/profiles/wcm_base/modules/custom/ocio_user_config/ocio_user_config.make index 63649a39..c04ee05c 100644 --- a/profiles/wcm_base/modules/custom/ocio_user_config/ocio_user_config.make +++ b/profiles/wcm_base/modules/custom/ocio_user_config/ocio_user_config.make @@ -9,5 +9,6 @@ core = 7.x projects[role_delegation][version] = 1.1 projects[role_delegation][subdir] = contrib -projects[administerusersbyrole][version] = 2.0-beta1 +projects[administerusersbyrole][version] = 2.0-rc1 projects[administerusersbyrole][subdir] = contrib +projects[administerusersbyrole][patch][2557473] = http://drupal.org/files/issues/administerusersbyrole-can_create_user_ajax_submit-2557473-13-D7.patch diff --git a/profiles/wcm_base/modules/custom/wcm_user_directory/README.md b/profiles/wcm_base/modules/custom/wcm_user_contact/README.md similarity index 100% rename from profiles/wcm_base/modules/custom/wcm_user_directory/README.md rename to profiles/wcm_base/modules/custom/wcm_user_contact/README.md diff --git a/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.context.inc b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.context.inc new file mode 100644 index 00000000..a9d826a0 --- /dev/null +++ b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.context.inc @@ -0,0 +1,46 @@ +<?php +/** + * @file + * wcm_user_contact.context.inc + */ + +/** + * Implements hook_context_default_contexts(). + */ +function wcm_user_contact_context_default_contexts() { + $export = array(); + + $context = new stdClass(); + $context->disabled = FALSE; /* Edit this to true to make a default context disabled initially */ + $context->api_version = 3; + $context->name = 'user-contact-page'; + $context->description = ''; + $context->tag = 'WCM User Contact'; + $context->conditions = array( + 'path' => array( + 'values' => array( + 'contact' => 'contact', + ), + ), + ); + $context->reactions = array( + 'block' => array( + 'blocks' => array( + 'views-user_contact-block_1' => array( + 'module' => 'views', + 'delta' => 'user_contact-block_1', + 'region' => 'content', + 'weight' => '-10', + ), + ), + ), + ); + $context->condition_mode = 0; + + // Translatables + // Included for use with string extractors like potx. + t('WCM User Contact'); + $export['user-contact-page'] = $context; + + return $export; +} diff --git a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.features.field_base.inc b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.features.field_base.inc similarity index 63% rename from profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.features.field_base.inc rename to profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.features.field_base.inc index bb27cdd7..47596f38 100644 --- a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.features.field_base.inc +++ b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.features.field_base.inc @@ -1,22 +1,22 @@ <?php /** * @file - * wcm_user_directory.features.field_base.inc + * wcm_user_contact.features.field_base.inc */ /** * Implements hook_field_default_field_bases(). */ -function wcm_user_directory_field_default_field_bases() { +function wcm_user_contact_field_default_field_bases() { $field_bases = array(); - // Exported field_base: 'field_display_in_directory' - $field_bases['field_display_in_directory'] = array( + // Exported field_base: 'field_display_on_contact_page' + $field_bases['field_display_on_contact_page'] = array( 'active' => 1, 'cardinality' => 1, 'deleted' => 0, 'entity_types' => array(), - 'field_name' => 'field_display_in_directory', + 'field_name' => 'field_display_on_contact_page', 'indexes' => array( 'value' => array( 0 => 'value', @@ -26,8 +26,8 @@ function wcm_user_directory_field_default_field_bases() { 'module' => 'list', 'settings' => array( 'allowed_values' => array( - 0 => 'no', - 1 => 'yes', + 0 => 0, + 1 => 1, ), 'allowed_values_function' => '', ), diff --git a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.features.field_instance.inc b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.features.field_instance.inc similarity index 54% rename from profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.features.field_instance.inc rename to profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.features.field_instance.inc index 52a6840b..3f2aae1a 100644 --- a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.features.field_instance.inc +++ b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.features.field_instance.inc @@ -1,17 +1,17 @@ <?php /** * @file - * wcm_user_directory.features.field_instance.inc + * wcm_user_contact.features.field_instance.inc */ /** * Implements hook_field_default_field_instances(). */ -function wcm_user_directory_field_default_field_instances() { +function wcm_user_contact_field_default_field_instances() { $field_instances = array(); - // Exported field_instance: 'user-user-field_display_in_directory' - $field_instances['user-user-field_display_in_directory'] = array( + // Exported field_instance: 'user-user-field_display_on_contact_page' + $field_instances['user-user-field_display_on_contact_page'] = array( 'bundle' => 'user', 'default_value' => array( 0 => array( @@ -19,50 +19,32 @@ function wcm_user_directory_field_default_field_instances() { ), ), 'deleted' => 0, - 'description' => 'Check this box if this person should be included in the departmental "people" directory. ', + 'description' => 'Check this box if this person should be included on the contact page.', 'display' => array( 'default' => array( 'label' => 'above', 'module' => 'list', 'settings' => array(), 'type' => 'list_default', - 'weight' => 9, + 'weight' => 7, ), - 'directory' => array( - 'label' => 'above', - 'settings' => array(), - 'type' => 'hidden', - 'weight' => 10, - ), - 'featured' => array( + 'full' => array( 'label' => 'above', 'settings' => array(), 'type' => 'hidden', 'weight' => 0, ), - 'full' => array( - 'label' => 'hidden', - 'settings' => array(), - 'type' => 'hidden', - 'weight' => 8, - ), 'leadership_listing' => array( 'label' => 'above', 'settings' => array(), 'type' => 'hidden', - 'weight' => 8, - ), - 'leadership_profile' => array( - 'label' => 'above', - 'settings' => array(), - 'type' => 'hidden', - 'weight' => 8, + 'weight' => 0, ), ), 'ds_extras_field_template' => '', 'entity_type' => 'user', - 'field_name' => 'field_display_in_directory', - 'label' => 'Display in Directory', + 'field_name' => 'field_display_on_contact_page', + 'label' => 'Display on Contact Page', 'required' => 0, 'settings' => array( 'user_register_form' => 1, @@ -74,14 +56,14 @@ function wcm_user_directory_field_default_field_instances() { 'display_label' => 1, ), 'type' => 'options_onoff', - 'weight' => 8, + 'weight' => 10, ), ); // Translatables // Included for use with string extractors like potx. - t('Check this box if this person should be included in the departmental "people" directory. '); - t('Display in Directory'); + t('Check this box if this person should be included on the contact page.'); + t('Display on Contact Page'); return $field_instances; } diff --git a/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.features.inc b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.features.inc new file mode 100644 index 00000000..1af255da --- /dev/null +++ b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.features.inc @@ -0,0 +1,21 @@ +<?php +/** + * @file + * wcm_user_contact.features.inc + */ + +/** + * Implements hook_ctools_plugin_api(). + */ +function wcm_user_contact_ctools_plugin_api($module = NULL, $api = NULL) { + if ($module == "context" && $api == "context") { + return array("version" => "3"); + } +} + +/** + * Implements hook_views_api(). + */ +function wcm_user_contact_views_api($module = NULL, $api = NULL) { + return array("api" => "3.0"); +} diff --git a/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.info b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.info new file mode 100644 index 00000000..565bf6cf --- /dev/null +++ b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.info @@ -0,0 +1,19 @@ +name = WCM User Contact +description = Creates a user contact page from selected user profiles. +core = 7.x +package = WCM Features +version = 7.x-1.0 +project = wcm_user_contact +dependencies[] = context +dependencies[] = features +dependencies[] = list +dependencies[] = views +features[context][] = user-contact-page +features[ctools][] = context:context:3 +features[ctools][] = views:views_default:3.0 +features[features_api][] = api:2 +features[field_base][] = field_display_on_contact_page +features[field_instance][] = user-user-field_display_on_contact_page +features[views_view][] = user_contact +features_exclude[dependencies][ctools] = ctools +features_exclude[dependencies][options] = options diff --git a/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.module b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.module new file mode 100644 index 00000000..7f4e86da --- /dev/null +++ b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.module @@ -0,0 +1,7 @@ +<?php +/** + * @file + * Code for the WCM User Contact feature. + */ + +include_once 'wcm_user_contact.features.inc'; diff --git a/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.views_default.inc b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.views_default.inc new file mode 100644 index 00000000..d6bd5dcd --- /dev/null +++ b/profiles/wcm_base/modules/custom/wcm_user_contact/wcm_user_contact.views_default.inc @@ -0,0 +1,202 @@ +<?php +/** + * @file + * wcm_user_contact.views_default.inc + */ + +/** + * Implements hook_views_default_views(). + */ +function wcm_user_contact_views_default_views() { + $export = array(); + + $view = new view(); + $view->name = 'user_contact'; + $view->description = ''; + $view->tag = 'default'; + $view->base_table = 'users'; + $view->human_name = 'User Contact'; + $view->core = 7; + $view->api_version = '3.0'; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + + /* Display: Master */ + $handler = $view->new_display('default', 'Master', 'default'); + $handler->display->display_options['title'] = 'Contact'; + $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['access']['type'] = 'perm'; + $handler->display->display_options['access']['perm'] = 'access user profiles'; + $handler->display->display_options['cache']['type'] = 'none'; + $handler->display->display_options['query']['type'] = 'views_query'; + $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['pager']['type'] = 'none'; + $handler->display->display_options['style_plugin'] = 'default'; + $handler->display->display_options['row_plugin'] = 'fields'; + /* Field: User: User Photo */ + $handler->display->display_options['fields']['field_user_photo']['id'] = 'field_user_photo'; + $handler->display->display_options['fields']['field_user_photo']['table'] = 'field_data_field_user_photo'; + $handler->display->display_options['fields']['field_user_photo']['field'] = 'field_user_photo'; + $handler->display->display_options['fields']['field_user_photo']['label'] = ''; + $handler->display->display_options['fields']['field_user_photo']['element_label_colon'] = FALSE; + $handler->display->display_options['fields']['field_user_photo']['click_sort_column'] = 'fid'; + $handler->display->display_options['fields']['field_user_photo']['settings'] = array( + 'image_style' => 'user_picture', + 'image_link' => 'content', + ); + /* Field: Realname: Real name */ + $handler->display->display_options['fields']['realname']['id'] = 'realname'; + $handler->display->display_options['fields']['realname']['table'] = 'realname'; + $handler->display->display_options['fields']['realname']['field'] = 'realname'; + $handler->display->display_options['fields']['realname']['label'] = ''; + $handler->display->display_options['fields']['realname']['element_type'] = 'h2'; + $handler->display->display_options['fields']['realname']['element_label_colon'] = FALSE; + /* Field: User: Title */ + $handler->display->display_options['fields']['field_job_title']['id'] = 'field_job_title'; + $handler->display->display_options['fields']['field_job_title']['table'] = 'field_data_field_job_title'; + $handler->display->display_options['fields']['field_job_title']['field'] = 'field_job_title'; + $handler->display->display_options['fields']['field_job_title']['label'] = ''; + $handler->display->display_options['fields']['field_job_title']['element_label_colon'] = FALSE; + /* Field: User: E-mail */ + $handler->display->display_options['fields']['mail']['id'] = 'mail'; + $handler->display->display_options['fields']['mail']['table'] = 'users'; + $handler->display->display_options['fields']['mail']['field'] = 'mail'; + $handler->display->display_options['fields']['mail']['label'] = ''; + $handler->display->display_options['fields']['mail']['element_label_colon'] = FALSE; + /* Field: User: Bio */ + $handler->display->display_options['fields']['field_bio']['id'] = 'field_bio'; + $handler->display->display_options['fields']['field_bio']['table'] = 'field_data_field_bio'; + $handler->display->display_options['fields']['field_bio']['field'] = 'field_bio'; + $handler->display->display_options['fields']['field_bio']['label'] = ''; + $handler->display->display_options['fields']['field_bio']['exclude'] = TRUE; + $handler->display->display_options['fields']['field_bio']['alter']['text'] = '[field_bio]'; + $handler->display->display_options['fields']['field_bio']['alter']['max_length'] = '400'; + $handler->display->display_options['fields']['field_bio']['alter']['more_link'] = TRUE; + $handler->display->display_options['fields']['field_bio']['alter']['more_link_text'] = 'Learn More'; + $handler->display->display_options['fields']['field_bio']['alter']['trim'] = TRUE; + $handler->display->display_options['fields']['field_bio']['element_label_colon'] = FALSE; + /* Sort criterion: Draggableviews: Weight */ + $handler->display->display_options['sorts']['weight']['id'] = 'weight'; + $handler->display->display_options['sorts']['weight']['table'] = 'draggableviews_structure'; + $handler->display->display_options['sorts']['weight']['field'] = 'weight'; + $handler->display->display_options['sorts']['weight']['draggableviews_setting_view'] = 'leadership_listing:page_2'; + $handler->display->display_options['sorts']['weight']['draggableviews_setting_new_items_bottom_list'] = 1; + /* Filter criterion: User: Active */ + $handler->display->display_options['filters']['status']['id'] = 'status'; + $handler->display->display_options['filters']['status']['table'] = 'users'; + $handler->display->display_options['filters']['status']['field'] = 'status'; + $handler->display->display_options['filters']['status']['value'] = '1'; + $handler->display->display_options['filters']['status']['group'] = 1; + $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; + /* Filter criterion: User: Display on Contact Page (field_display_on_contact_page) */ + $handler->display->display_options['filters']['field_display_on_contact_page_value']['id'] = 'field_display_on_contact_page_value'; + $handler->display->display_options['filters']['field_display_on_contact_page_value']['table'] = 'field_data_field_display_on_contact_page'; + $handler->display->display_options['filters']['field_display_on_contact_page_value']['field'] = 'field_display_on_contact_page_value'; + $handler->display->display_options['filters']['field_display_on_contact_page_value']['value'] = array( + 1 => '1', + ); + + /* Display: Block */ + $handler = $view->new_display('block', 'Block', 'block_1'); + + /* Display: Page */ + $handler = $view->new_display('page', 'Page', 'page_1'); + $handler->display->display_options['path'] = 'contact'; + + /* Display: Admin Page */ + $handler = $view->new_display('page', 'Admin Page', 'page_2'); + $handler->display->display_options['defaults']['access'] = FALSE; + $handler->display->display_options['access']['type'] = 'menu'; + $handler->display->display_options['defaults']['style_plugin'] = FALSE; + $handler->display->display_options['style_plugin'] = 'table'; + $handler->display->display_options['style_options']['columns'] = array( + 'draggableviews' => 'draggableviews', + 'field_user_photo' => 'field_user_photo', + 'realname' => 'realname', + 'field_job_title' => 'field_job_title', + 'mail' => 'mail', + ); + $handler->display->display_options['style_options']['default'] = '-1'; + $handler->display->display_options['style_options']['info'] = array( + 'draggableviews' => array( + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'field_user_photo' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => 'views-align-center', + 'separator' => '', + 'empty_column' => 0, + ), + 'realname' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'field_job_title' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + 'mail' => array( + 'sortable' => 0, + 'default_sort_order' => 'asc', + 'align' => '', + 'separator' => '', + 'empty_column' => 0, + ), + ); + $handler->display->display_options['defaults']['style_options'] = FALSE; + $handler->display->display_options['defaults']['row_plugin'] = FALSE; + $handler->display->display_options['defaults']['row_options'] = FALSE; + $handler->display->display_options['defaults']['fields'] = FALSE; + /* Field: Draggableviews: User */ + $handler->display->display_options['fields']['draggableviews']['id'] = 'draggableviews'; + $handler->display->display_options['fields']['draggableviews']['table'] = 'users'; + $handler->display->display_options['fields']['draggableviews']['field'] = 'draggableviews'; + $handler->display->display_options['fields']['draggableviews']['element_default_classes'] = FALSE; + $handler->display->display_options['fields']['draggableviews']['hide_alter_empty'] = FALSE; + $handler->display->display_options['fields']['draggableviews']['draggableviews']['ajax'] = 0; + /* Field: User: User Photo */ + $handler->display->display_options['fields']['field_user_photo']['id'] = 'field_user_photo'; + $handler->display->display_options['fields']['field_user_photo']['table'] = 'field_data_field_user_photo'; + $handler->display->display_options['fields']['field_user_photo']['field'] = 'field_user_photo'; + $handler->display->display_options['fields']['field_user_photo']['label'] = 'Photo'; + $handler->display->display_options['fields']['field_user_photo']['element_label_colon'] = FALSE; + $handler->display->display_options['fields']['field_user_photo']['click_sort_column'] = 'fid'; + $handler->display->display_options['fields']['field_user_photo']['settings'] = array( + 'image_style' => 'tiny', + 'image_link' => 'content', + ); + /* Field: Realname: Real name */ + $handler->display->display_options['fields']['realname']['id'] = 'realname'; + $handler->display->display_options['fields']['realname']['table'] = 'realname'; + $handler->display->display_options['fields']['realname']['field'] = 'realname'; + $handler->display->display_options['fields']['realname']['label'] = 'Name'; + $handler->display->display_options['fields']['realname']['element_label_colon'] = FALSE; + /* Field: User: Title */ + $handler->display->display_options['fields']['field_job_title']['id'] = 'field_job_title'; + $handler->display->display_options['fields']['field_job_title']['table'] = 'field_data_field_job_title'; + $handler->display->display_options['fields']['field_job_title']['field'] = 'field_job_title'; + $handler->display->display_options['fields']['field_job_title']['element_label_colon'] = FALSE; + /* Field: User: E-mail */ + $handler->display->display_options['fields']['mail']['id'] = 'mail'; + $handler->display->display_options['fields']['mail']['table'] = 'users'; + $handler->display->display_options['fields']['mail']['field'] = 'mail'; + $handler->display->display_options['fields']['mail']['label'] = 'Email'; + $handler->display->display_options['fields']['mail']['element_label_colon'] = FALSE; + $handler->display->display_options['path'] = 'admin/people/contact'; + $handler->display->display_options['menu']['type'] = 'tab'; + $handler->display->display_options['menu']['title'] = 'Contact'; + $handler->display->display_options['menu']['weight'] = '0'; + $handler->display->display_options['menu']['context'] = 0; + $handler->display->display_options['menu']['context_only_inline'] = 0; + $export['user_contact'] = $view; + + return $export; +} diff --git a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.features.inc b/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.features.inc deleted file mode 100644 index 6a52415c..00000000 --- a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.features.inc +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * @file - * wcm_user_directory.features.inc - */ - -/** - * Implements hook_ctools_plugin_api(). - */ -function wcm_user_directory_ctools_plugin_api($module = NULL, $api = NULL) { - if ($module == "ds" && $api == "ds") { - return array("version" => "1"); - } -} - -/** - * Implements hook_views_api(). - */ -function wcm_user_directory_views_api($module = NULL, $api = NULL) { - return array("api" => "3.0"); -} diff --git a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.info b/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.info deleted file mode 100644 index fa8ebf8b..00000000 --- a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.info +++ /dev/null @@ -1,18 +0,0 @@ -name = WCM User Directory -description = Directory view and settings for a departmental directory on WCM sites. -core = 7.x -package = WCM Features -version = 7.x-1.0 -project = wcm_user_directory -dependencies[] = features -dependencies[] = number -dependencies[] = options -dependencies[] = views -features[ctools][] = ds:ds:1 -features[ctools][] = views:views_default:3.0 -features[features_api][] = api:2 -features[field_base][] = field_display_in_directory -features[field_instance][] = user-user-field_display_in_directory -features_exclude[dependencies][ctools] = ctools -features_exclude[dependencies][ds] = ds -features_exclude[dependencies][list] = list diff --git a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.module b/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.module deleted file mode 100644 index 0639d6d6..00000000 --- a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.module +++ /dev/null @@ -1,7 +0,0 @@ -<?php -/** - * @file - * Code for the WCM User Directory feature. - */ - -include_once 'wcm_user_directory.features.inc'; diff --git a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.views_default.inc b/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.views_default.inc deleted file mode 100644 index 88c678b7..00000000 --- a/profiles/wcm_base/modules/custom/wcm_user_directory/wcm_user_directory.views_default.inc +++ /dev/null @@ -1,100 +0,0 @@ -<?php -/** - * @file - * wcm_user_directory.views_default.inc - */ - -/** - * Implements hook_views_default_views(). - */ -function wcm_user_directory_views_default_views() { - $export = array(); - - $view = new view(); - $view->name = 'user_directory'; - $view->description = ''; - $view->tag = 'OCIO User Directory'; - $view->base_table = 'users'; - $view->human_name = 'User Directory'; - $view->core = 7; - $view->api_version = '3.0'; - $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ - - /* Display: Master */ - $handler = $view->new_display('default', 'Master', 'default'); - $handler->display->display_options['title'] = 'Directory'; - $handler->display->display_options['use_more_always'] = FALSE; - $handler->display->display_options['access']['type'] = 'none'; - $handler->display->display_options['cache']['type'] = 'none'; - $handler->display->display_options['query']['type'] = 'views_query'; - $handler->display->display_options['exposed_form']['type'] = 'basic'; - $handler->display->display_options['pager']['type'] = 'none'; - $handler->display->display_options['style_plugin'] = 'table'; - $handler->display->display_options['style_options']['columns'] = array( - 'name' => 'name', - ); - $handler->display->display_options['style_options']['default'] = '-1'; - $handler->display->display_options['style_options']['info'] = array( - 'name' => array( - 'sortable' => 0, - 'default_sort_order' => 'asc', - 'align' => '', - 'separator' => '', - 'empty_column' => 0, - ), - ); - /* Field: User: Last Name */ - $handler->display->display_options['fields']['field_last_name']['id'] = 'field_last_name'; - $handler->display->display_options['fields']['field_last_name']['table'] = 'field_data_field_last_name'; - $handler->display->display_options['fields']['field_last_name']['field'] = 'field_last_name'; - /* Field: User: First Name */ - $handler->display->display_options['fields']['field_first_name']['id'] = 'field_first_name'; - $handler->display->display_options['fields']['field_first_name']['table'] = 'field_data_field_first_name'; - $handler->display->display_options['fields']['field_first_name']['field'] = 'field_first_name'; - /* Field: User: Title */ - $handler->display->display_options['fields']['field_job_title']['id'] = 'field_job_title'; - $handler->display->display_options['fields']['field_job_title']['table'] = 'field_data_field_job_title'; - $handler->display->display_options['fields']['field_job_title']['field'] = 'field_job_title'; - /* Field: User: E-mail */ - $handler->display->display_options['fields']['mail']['id'] = 'mail'; - $handler->display->display_options['fields']['mail']['table'] = 'users'; - $handler->display->display_options['fields']['mail']['field'] = 'mail'; - /* Field: User: Phone */ - $handler->display->display_options['fields']['field_phone']['id'] = 'field_phone'; - $handler->display->display_options['fields']['field_phone']['table'] = 'field_data_field_phone'; - $handler->display->display_options['fields']['field_phone']['field'] = 'field_phone'; - /* Sort criterion: User: Last Name (field_last_name) */ - $handler->display->display_options['sorts']['field_last_name_value']['id'] = 'field_last_name_value'; - $handler->display->display_options['sorts']['field_last_name_value']['table'] = 'field_data_field_last_name'; - $handler->display->display_options['sorts']['field_last_name_value']['field'] = 'field_last_name_value'; - /* Sort criterion: User: First Name (field_first_name) */ - $handler->display->display_options['sorts']['field_first_name_value']['id'] = 'field_first_name_value'; - $handler->display->display_options['sorts']['field_first_name_value']['table'] = 'field_data_field_first_name'; - $handler->display->display_options['sorts']['field_first_name_value']['field'] = 'field_first_name_value'; - /* Filter criterion: User: Active */ - $handler->display->display_options['filters']['status']['id'] = 'status'; - $handler->display->display_options['filters']['status']['table'] = 'users'; - $handler->display->display_options['filters']['status']['field'] = 'status'; - $handler->display->display_options['filters']['status']['value'] = '1'; - $handler->display->display_options['filters']['status']['group'] = 1; - $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE; - /* Filter criterion: User: Display in Directory (field_display_in_directory) */ - $handler->display->display_options['filters']['field_display_in_directory_value']['id'] = 'field_display_in_directory_value'; - $handler->display->display_options['filters']['field_display_in_directory_value']['table'] = 'field_data_field_display_in_directory'; - $handler->display->display_options['filters']['field_display_in_directory_value']['field'] = 'field_display_in_directory_value'; - $handler->display->display_options['filters']['field_display_in_directory_value']['value'] = array( - 1 => '1', - ); - - /* Display: Page */ - $handler = $view->new_display('page', 'Page', 'page'); - $handler->display->display_options['path'] = 'directory'; - $handler->display->display_options['menu']['title'] = 'People'; - $handler->display->display_options['menu']['weight'] = '20'; - $handler->display->display_options['menu']['name'] = 'main-menu'; - $handler->display->display_options['menu']['context'] = 0; - $handler->display->display_options['menu']['context_only_inline'] = 0; - $export['user_directory'] = $view; - - return $export; -} diff --git a/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.features.field_base.inc b/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.features.field_base.inc index f04fcd45..ade0320c 100644 --- a/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.features.field_base.inc +++ b/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.features.field_base.inc @@ -26,8 +26,8 @@ function wcm_user_leadership_field_default_field_bases() { 'module' => 'list', 'settings' => array( 'allowed_values' => array( - 0 => '', - 1 => '', + 0 => 0, + 1 => 1, ), 'allowed_values_function' => '', ), diff --git a/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.features.field_instance.inc b/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.features.field_instance.inc index 768fb2d3..70e54bb9 100644 --- a/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.features.field_instance.inc +++ b/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.features.field_instance.inc @@ -26,7 +26,7 @@ function wcm_user_leadership_field_default_field_instances() { 'module' => 'list', 'settings' => array(), 'type' => 'list_default', - 'weight' => 11, + 'weight' => 8, ), 'featured' => array( 'label' => 'above', @@ -68,7 +68,7 @@ function wcm_user_leadership_field_default_field_instances() { 'display_label' => 1, ), 'type' => 'options_onoff', - 'weight' => 10, + 'weight' => 11, ), ); diff --git a/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.info b/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.info index 1c323113..db61d26b 100644 --- a/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.info +++ b/profiles/wcm_base/modules/custom/wcm_user_leadership/wcm_user_leadership.info @@ -9,6 +9,7 @@ dependencies[] = ds dependencies[] = features dependencies[] = list dependencies[] = number +dependencies[] = options dependencies[] = views dependencies[] = views_content features[context][] = user-leadership-page diff --git a/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.ds.inc b/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.ds.inc index 88dc6bb3..0ab44fb6 100644 --- a/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.ds.inc +++ b/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.ds.inc @@ -72,42 +72,44 @@ function wcm_user_profile_ds_layout_settings_info() { 'regions' => array( 'left' => array( 0 => 'account', + 1 => 'picture', ), 'right' => array( - 1 => 'field_first_name', - 2 => 'field_last_name', - 3 => 'field_job_title', - 4 => 'field_phone', + 2 => 'field_first_name', + 3 => 'field_last_name', + 4 => 'field_job_title', + 5 => 'field_phone', 6 => 'field_room_and_building', - 8 => 'field_street_address', - 9 => 'field_user_photo', - 10 => 'field_display_in_directory', - 11 => 'field_directory_display_order', - 12 => 'field_display_in_leadership_list', + 7 => 'field_street_address', + 8 => 'field_user_photo', + 9 => 'field_display_in_directory', + 10 => 'field_display_on_contact_page', + 11 => 'field_display_in_leadership_list', ), 'footer' => array( - 5 => 'wysiwyg', - 7 => 'timezone', - 13 => 'field_bio', + 12 => 'wysiwyg', + 13 => 'timezone', + 14 => 'field_bio', ), 'hidden' => array( - 14 => '_add_existing_field', + 15 => '_add_existing_field', ), ), 'fields' => array( 'account' => 'left', + 'picture' => 'left', 'field_first_name' => 'right', 'field_last_name' => 'right', 'field_job_title' => 'right', 'field_phone' => 'right', - 'wysiwyg' => 'footer', 'field_room_and_building' => 'right', - 'timezone' => 'footer', 'field_street_address' => 'right', 'field_user_photo' => 'right', 'field_display_in_directory' => 'right', - 'field_directory_display_order' => 'right', + 'field_display_on_contact_page' => 'right', 'field_display_in_leadership_list' => 'right', + 'wysiwyg' => 'footer', + 'timezone' => 'footer', 'field_bio' => 'footer', '_add_existing_field' => 'hidden', ), diff --git a/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.features.field_instance.inc b/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.features.field_instance.inc index 4730d198..e7e3f2a7 100644 --- a/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.features.field_instance.inc +++ b/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.features.field_instance.inc @@ -22,7 +22,7 @@ function wcm_user_profile_field_default_field_instances() { 'module' => 'ocio_field_bases', 'settings' => array(), 'type' => 'ocio_field_bases_accordion', - 'weight' => 4, + 'weight' => 2, ), 'directory' => array( 'label' => 'above', @@ -95,7 +95,7 @@ function wcm_user_profile_field_default_field_instances() { 'module' => 'ocio_field_bases', 'settings' => array(), 'type' => 'ocio_field_bases_accordion', - 'weight' => 13, + 'weight' => 9, ), 'directory' => array( 'label' => 'hidden', @@ -145,7 +145,7 @@ function wcm_user_profile_field_default_field_instances() { 'size' => 50, ), 'type' => 'text_textfield', - 'weight' => 1, + 'weight' => 2, ), ); @@ -161,7 +161,7 @@ function wcm_user_profile_field_default_field_instances() { 'module' => 'text', 'settings' => array(), 'type' => 'text_default', - 'weight' => 2, + 'weight' => 1, ), 'directory' => array( 'label' => 'hidden', @@ -219,7 +219,7 @@ function wcm_user_profile_field_default_field_instances() { 'size' => 60, ), 'type' => 'text_textfield', - 'weight' => 3, + 'weight' => 4, ), ); @@ -235,7 +235,7 @@ function wcm_user_profile_field_default_field_instances() { 'module' => 'ocio_field_bases', 'settings' => array(), 'type' => 'ocio_field_bases_accordion', - 'weight' => 14, + 'weight' => 10, ), 'directory' => array( 'label' => 'hidden', @@ -285,7 +285,7 @@ function wcm_user_profile_field_default_field_instances() { 'size' => 50, ), 'type' => 'text_textfield', - 'weight' => 2, + 'weight' => 3, ), ); @@ -301,7 +301,7 @@ function wcm_user_profile_field_default_field_instances() { 'module' => 'ocio_field_bases', 'settings' => array(), 'type' => 'ocio_field_bases_accordion', - 'weight' => 5, + 'weight' => 3, ), 'directory' => array( 'label' => 'hidden', @@ -358,7 +358,7 @@ function wcm_user_profile_field_default_field_instances() { 'size' => 20, ), 'type' => 'text_textfield', - 'weight' => 4, + 'weight' => 5, ), ); @@ -374,7 +374,7 @@ function wcm_user_profile_field_default_field_instances() { 'module' => 'ocio_field_bases', 'settings' => array(), 'type' => 'ocio_field_bases_accordion', - 'weight' => 6, + 'weight' => 5, ), 'directory' => array( 'label' => 'hidden', @@ -431,7 +431,7 @@ function wcm_user_profile_field_default_field_instances() { 'size' => 60, ), 'type' => 'text_textfield', - 'weight' => 5, + 'weight' => 6, ), ); @@ -447,7 +447,7 @@ function wcm_user_profile_field_default_field_instances() { 'module' => 'ocio_field_bases', 'settings' => array(), 'type' => 'ocio_field_bases_accordion', - 'weight' => 7, + 'weight' => 6, ), 'directory' => array( 'label' => 'hidden', @@ -504,7 +504,7 @@ function wcm_user_profile_field_default_field_instances() { 'size' => 60, ), 'type' => 'text_textfield', - 'weight' => 6, + 'weight' => 7, ), ); @@ -578,7 +578,7 @@ function wcm_user_profile_field_default_field_instances() { 'required' => 0, 'settings' => array( 'alt_field' => 0, - 'default_image' => 5, + 'default_image' => 0, 'file_directory' => 'user-photos', 'file_extensions' => 'png jpg jpeg', 'max_filesize' => '500 kb', @@ -610,7 +610,7 @@ function wcm_user_profile_field_default_field_instances() { ), 'manualcrop_crop_info' => 1, 'manualcrop_default_crop_area' => 1, - 'manualcrop_enable' => 1, + 'manualcrop_enable' => 0, 'manualcrop_inline_crop' => 0, 'manualcrop_instant_crop' => FALSE, 'manualcrop_instant_preview' => 1, @@ -622,9 +622,11 @@ function wcm_user_profile_field_default_field_instances() { 'manualcrop_styles_list' => array(), 'manualcrop_styles_mode' => 'include', 'manualcrop_thumblist' => 0, + 'preview_image_style' => 'thumbnail', + 'progress_indicator' => 'throbber', ), 'type' => 'media_generic', - 'weight' => 7, + 'weight' => 8, ), ); diff --git a/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.module b/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.module index b5b927f1..6bd41bac 100644 --- a/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.module +++ b/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.module @@ -19,7 +19,9 @@ function wcm_user_profile_user_view_alter(&$build) { $lead = !empty($account->field_display_in_leadership_list['und'][0]['value']); $access = $dir || $lead; - if (!($access || user_access('view user profiles'))) { + global $user; + + if (!($access || $user->uid == $account->uid || user_access('view user profiles'))) { drupal_set_breadcrumb(''); drupal_access_denied(); module_invoke_all('exit'); diff --git a/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.strongarm.inc b/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.strongarm.inc index 30f2997e..b7fd9016 100644 --- a/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.strongarm.inc +++ b/profiles/wcm_base/modules/custom/wcm_user_profile/wcm_user_profile.strongarm.inc @@ -32,19 +32,22 @@ function wcm_user_profile_strongarm() { 'extra_fields' => array( 'form' => array( 'account' => array( - 'weight' => '-10', + 'weight' => '0', ), 'timezone' => array( - 'weight' => '6', + 'weight' => '13', ), 'wysiwyg' => array( - 'weight' => '5', + 'weight' => '12', + ), + 'picture' => array( + 'weight' => '1', ), ), 'display' => array( 'summary' => array( 'default' => array( - 'weight' => '5', + 'weight' => '4', 'visible' => TRUE, ), 'featured' => array( diff --git a/profiles/wcm_base/wcm_base.info b/profiles/wcm_base/wcm_base.info index 6a51a928..514064e4 100644 --- a/profiles/wcm_base/wcm_base.info +++ b/profiles/wcm_base/wcm_base.info @@ -114,7 +114,7 @@ dependencies[] = ocio_workbench dependencies[] = ocio_wysiwyg dependencies[] = wcm_front_page dependencies[] = wcm_tile_panes -dependencies[] = wcm_user_directory +dependencies[] = wcm_user_contact dependencies[] = wcm_user_leadership dependencies[] = wcm_user_profile diff --git a/profiles/wcm_base/wcm_base.make b/profiles/wcm_base/wcm_base.make index b8043b2f..b6f66588 100644 --- a/profiles/wcm_base/wcm_base.make +++ b/profiles/wcm_base/wcm_base.make @@ -290,11 +290,11 @@ projects[wcm_tile_panes][download][type] = "git" projects[wcm_tile_panes][download][url] = git@code.osu.edu:ocio_odee_web/wcm_tile_panes.git projects[wcm_tile_panes][download][branch] = 7.x-1.x -projects[wcm_user_directory][type] = module -projects[wcm_user_directory][subdir] = custom -projects[wcm_user_directory][download][type] = "git" -projects[wcm_user_directory][download][url] = git@code.osu.edu:ocio_odee_web/wcm_user_directory.git -projects[wcm_user_directory][download][branch] = 7.x-1.x +projects[wcm_user_contact][type] = module +projects[wcm_user_contact][subdir] = custom +projects[wcm_user_contact][download][type] = "git" +projects[wcm_user_contact][download][url] = git@code.osu.edu:ocio_odee_web/wcm_user_contact.git +projects[wcm_user_contact][download][branch] = 7.x-1.x projects[wcm_user_leadership][type] = module projects[wcm_user_leadership][subdir] = custom -- GitLab