Refactor commons build process

Update commons modules to release 7.12, and move the codebase under
modules/commons instead of constant fetching from remote repository.
The commons.make file removed so it is not required to rebuild
groups distribution.

Change-Id: I3be393ba1af34427e2915b18ab1ad718fd4e54db
This commit is contained in:
Marton Kiss 2014-05-28 15:58:33 +02:00
parent 9faaea5e06
commit 8ac59801be
397 changed files with 38560 additions and 371 deletions

View File

@ -1,152 +0,0 @@
api = 2
core = 7.x
; Commons modules.
projects[commons_activity_streams][type] = "module"
projects[commons_activity_streams][subdir] = "commons"
projects[commons_activity_streams][download][url] = "http://git.drupal.org/project/commons_activity_streams.git"
projects[commons_activity_streams][download][branch] = "7.x-3.x"
projects[commons_featured][type] = "module"
projects[commons_featured][subdir] = "commons"
projects[commons_featured][download][url] = "http://git.drupal.org/project/commons_featured.git"
projects[commons_featured][download][branch] = "7.x-3.x"
projects[commons_notices][type] = "module"
projects[commons_notices][subdir] = "commons"
projects[commons_notices][download][url] = "http://git.drupal.org/project/commons_notices.git"
projects[commons_notices][download][branch] = "7.x-3.x"
projects[commons_profile_social][type] = "module"
projects[commons_profile_social][subdir] = "commons"
projects[commons_profile_social][download][url] = "http://git.drupal.org/project/commons_profile_social.git"
projects[commons_profile_social][download][branch] = "7.x-3.x"
projects[commons_user_profile_pages][type] = "module"
projects[commons_user_profile_pages][subdir] = "commons"
projects[commons_user_profile_pages][download][url] = "http://git.drupal.org/project/commons_user_profile_pages.git"
projects[commons_user_profile_pages][download][branch] = "7.x-3.x"
projects[commons_body][type] = "module"
projects[commons_body][subdir] = "commons"
projects[commons_body][download][url] = "http://git.drupal.org/project/commons_body.git"
projects[commons_body][download][branch] = "7.x-3.x"
projects[commons_follow][type] = "module"
projects[commons_follow][subdir] = "commons"
projects[commons_follow][download][url] = "http://git.drupal.org/project/commons_follow.git"
projects[commons_follow][download][branch] = "7.x-3.x"
projects[commons_notify][type] = "module"
projects[commons_notify][subdir] = "commons"
projects[commons_notify][download][url] = "http://git.drupal.org/project/commons_notify.git"
projects[commons_notify][download][branch] = "7.x-3.x"
projects[commons_utility_links][type] = "module"
projects[commons_utility_links][subdir] = "commons"
projects[commons_utility_links][download][url] = "http://git.drupal.org/project/commons_utility_links.git"
projects[commons_utility_links][download][branch] = "7.x-3.x"
; add utility links block to openstack theme instead of commons_origins
projects[commons_utility_links][patch][] = "patches/0001-utility-links-block-install-theme.patch"
projects[commons_bw][type] = "module"
projects[commons_bw][subdir] = "commons"
projects[commons_bw][download][url] = "http://git.drupal.org/project/commons_bw.git"
projects[commons_bw][download][branch] = "7.x-3.x"
projects[commons_groups][type] = "module"
projects[commons_groups][subdir] = "commons"
projects[commons_groups][download][url] = "http://git.drupal.org/project/commons_groups.git"
projects[commons_groups][download][branch] = "7.x-3.x"
; Error notice when creating or updating groups with locale module enabled
; https://drupal.org/node/2039619#comment-7854797
projects[commons_groups][patch][] = "patches/2039619-remove-privacy-settings-wrapper-4.patch"
projects[commons_pages][type] = "module"
projects[commons_pages][subdir] = "commons"
projects[commons_pages][download][url] = "http://git.drupal.org/project/commons_pages.git"
projects[commons_pages][download][branch] = "7.x-3.x"
projects[commons_radioactivity][type] = "module"
projects[commons_radioactivity][subdir] = "commons"
projects[commons_radioactivity][download][url] = "http://git.drupal.org/project/commons_radioactivity.git"
projects[commons_radioactivity][download][branch] = "7.x-3.x"
projects[commons_content_moderation][type] = "module"
projects[commons_content_moderation][subdir] = "commons"
projects[commons_content_moderation][download][url] = "http://git.drupal.org/project/commons_content_moderation.git"
projects[commons_content_moderation][download][branch] = "7.x-3.x"
projects[commons_like][type] = "module"
projects[commons_like][subdir] = "commons"
projects[commons_like][download][url] = "http://git.drupal.org/project/commons_like.git"
projects[commons_like][download][branch] = "7.x-3.x"
projects[commons_search][type] = "module"
projects[commons_search][subdir] = "commons"
projects[commons_search][download][url] = "http://git.drupal.org/project/commons_search.git"
projects[commons_search][download][branch] = "7.x-3.x"
projects[commons_wysiwyg][type] = "module"
projects[commons_wysiwyg][subdir] = "commons"
projects[commons_wysiwyg][download][url] = "http://git.drupal.org/project/commons_wysiwyg.git"
projects[commons_wysiwyg][download][branch] = "7.x-3.x"
projects[commons_documents][type] = "module"
projects[commons_documents][subdir] = "commons"
projects[commons_documents][download][url] = "http://git.drupal.org/project/commons_documents.git"
projects[commons_documents][download][branch] = "7.x-3.x"
projects[commons_location][type] = "module"
projects[commons_location][subdir] = "commons"
projects[commons_location][download][url] = "http://git.drupal.org/project/commons_location.git"
projects[commons_location][download][branch] = "7.x-3.x"
projects[commons_posts][type] = "module"
projects[commons_posts][subdir] = "commons"
projects[commons_posts][download][url] = "http://git.drupal.org/project/commons_posts.git"
projects[commons_posts][download][branch] = "7.x-3.x"
projects[commons_site_homepage][type] = "module"
projects[commons_site_homepage][subdir] = "commons"
projects[commons_site_homepage][download][url] = "http://git.drupal.org/project/commons_site_homepage.git"
projects[commons_site_homepage][download][branch] = "7.x-3.x"
projects[commons_events][type] = "module"
projects[commons_events][subdir] = "commons"
projects[commons_events][download][url] = "http://git.drupal.org/project/commons_events.git"
projects[commons_events][download][branch] = "7.x-3.x"
projects[commons_misc][type] = "module"
projects[commons_misc][subdir] = "commons"
projects[commons_misc][download][url] = "http://git.drupal.org/project/commons_misc.git"
projects[commons_misc][download][branch] = "7.x-3.x"
projects[commons_profile_base][type] = "module"
projects[commons_profile_base][subdir] = "commons"
projects[commons_profile_base][download][url] = "http://git.drupal.org/project/commons_profile_base.git"
projects[commons_profile_base][download][branch] = "7.x-3.x"
projects[commons_topics][type] = "module"
projects[commons_topics][subdir] = "commons"
projects[commons_topics][download][url] = "http://git.drupal.org/project/commons_topics.git"
projects[commons_topics][download][branch] = "7.x-3.x"
projects[commons_social_sharing][type] = "module"
projects[commons_social_sharing][subdir] = "commons"
projects[commons_social_sharing][download][url] = "http://git.drupal.org/project/commons_social_sharing.git"
projects[commons_social_sharing][download][branch] = "7.x-3.x"
projects[commons_trusted_contacts][type] = "module"
projects[commons_trusted_contacts][subdir] = "commons"
projects[commons_trusted_contacts][download][url] = "http://git.drupal.org/project/commons_trusted_contacts.git"
projects[commons_trusted_contacts][download][branch] = "7.x-3.x"
projects[commons_origins][type] = "theme"
projects[commons_origins][subdir] = "commons"
projects[commons_origins][download][url] = "http://git.drupal.org/project/commons_origins.git"
projects[commons_origins][download][branch] = "7.x-3.x"

View File

@ -3,19 +3,9 @@ core = 7.x
; Download Drupal core and apply core patches if needed.
projects[drupal][type] = "core"
projects[drupal][version] = "7.27"
projects[drupal][version] = "7.28"
projects[drupal][download][type] = get
projects[drupal][download][url] = http://ftp.drupal.org/files/projects/drupal-7.27.tar.gz
; Hide the profiles under /profiles, so Commons is the only one. This allows
; the installation to start at the Language selection screen, bypassing a
; baffling and silly choice, especially for non-native speakers.
; http://drupal.org/node/1780598#comment-6480088
projects[drupal][patch][] = http://drupal.org/files/spark-install-1780598-5.patch
; This requires a core bug fix to not show the profile selection page when only
; one profile is visible.
; http://drupal.org/node/1074108#comment-6463662
projects[drupal][patch][] = http://drupal.org/files/1074108-skip-profile-16-7.x-do-not-test.patch
projects[drupal][download][url] = http://ftp.drupal.org/files/projects/drupal-7.28.tar.gz
; This patch allows install profile to list requirements on the install page
; http://drupal.org/node/1971072
@ -28,3 +18,15 @@ projects[drupal][patch][] = http://drupal.org/files/drupal-7.x-allow_profile_cha
; Allow to specify SCRIPT HTML element attributes through drupal_add_js()
; http://drupal.org/node/1664602#comment-6221066
projects[drupal][patch][] = http://drupal.org/files/1664602-1.patch
; Optimize node access queries.
; https://drupal.org/comment/8516319#comment-8516319
projects[drupal][patch][] = https://drupal.org/files/issues/drupal-optimize_node_access_queries-106721-D7-71-do-not-test.patch
; Statically cache node access grants
; https://drupal.org/comment/8495029#comment-8495029
projects[drupal][patch][] = https://drupal.org/files/issues/node_access_grants-static-cache-11.patch
; File_get_file_references is slow and buggy
; https://drupal.org/node/1805690#comment-8734045
projects[drupal][patch][] = https://drupal.org/files/issues/1805690_11.patch

View File

@ -1,9 +1,6 @@
api = 2
core = 7.x
includes[commons] = "commons.make"
includes[translations] = "groups-translations.make"
; Contributed modules.
projects[addressfield][type] = "module"
@ -12,22 +9,29 @@ projects[addressfield][version] = "1.0-beta5"
projects[addressfield_tokens][type] = "module"
projects[addressfield_tokens][subdir] = "contrib"
projects[addressfield_tokens][version] = "1.3"
projects[addressfield_tokens][version] = "1.4"
projects[advancedqueue][type] = "module"
projects[advancedqueue][subdir] = "contrib"
projects[advancedqueue][version] = "1.0-alpha2"
projects[admin_icons][type] = "module"
projects[admin_icons][subdir] = "contrib"
projects[admin_icons][download][type] = "git"
projects[admin_icons][download][url] = "http://git.drupal.org/project/admin_icons.git"
projects[admin_icons][download][branch] = "7.x-1.x"
projects[admin_icons][download][revision] = "60d9f28801533fecc92216a60d444d89d80e7611"
projects[apachesolr][type] = "module"
projects[apachesolr][subdir] = "contrib"
projects[apachesolr][version] = "1.4"
projects[apachesolr][version] = "1.6"
projects[apachesolr_og][type] = "module"
projects[apachesolr_og][subdir] = "contrib"
projects[apachesolr_og][download][type] = "git"
projects[apachesolr_og][download][url] = "http://git.drupal.org/project/apachesolr_og.git"
projects[apachesolr_og][download][branch] = "7.x-1.x"
projects[apachesolr_og][download]revision] = "49820b4a4fcff7c1c4efe449da033fb6d8711ac5"
projects[apachesolr_og][download][revision] = "49820b4a4fcff7c1c4efe449da033fb6d8711ac5"
; Check the user object before trying to display a result.
; https://drupal.org/node/2077281#comment-7807937
projects[apachesolr_og][patch][] = "https://drupal.org/files/issues/apachesolr_og-check-for-anonymous.patch"
projects[apachesolr_proximity][type] = "module"
projects[apachesolr_proximity][subdir] = "contrib"
@ -40,13 +44,16 @@ projects[apachesolr_user][download][url] = "http://git.drupal.org/project/apache
projects[apachesolr_user][download][branch] = "7.x-1.x"
projects[apachesolr_user][download]revision] = "a86c5aebfceaf4a3fc53544762a36ca1b70809d5"
; Check the user object before trying to display a result
; Check the user object before trying to display a result.
; https://drupal.org/node/2077281#comment-7807937
projects[apachesolr_user][patch][] = "http://drupal.org/files/2077281-apache-solr-user-check-3.patch"
projects[breakpoints][type] = "module"
projects[breakpoints][subdir] = "contrib"
projects[breakpoints][version] = "1.1"
projects[breakpoints][download][type] = "git"
projects[breakpoints][download][url] = "http://git.drupal.org/project/breakpoints.git"
projects[breakpoints][download][branch] = "7.x-1.x"
projects[breakpoints][download][revision] = "c4f3665"
projects[connector][type] = "module"
projects[connector][subdir] = "contrib"
@ -54,24 +61,38 @@ projects[connector][version] = "1.0-beta2"
projects[ckeditor][type] = "module"
projects[ckeditor][subdir] = "contrib"
projects[ckeditor][version] = "1.13"
projects[ckeditor][download][type] = "git"
projects[ckeditor][download][url] = "http://git.drupal.org/project/ckeditor.git"
projects[ckeditor][download][branch] = "7.x-1.x"
projects[ckeditor][download][revision] = "b69a9ac"
; Only load CSS when necessary.
; https://drupal.org/node/1370894
projects[ckeditor][patch][] = "https://drupal.org/files/issues/attach-ckeditor-css-1370894-8.patch"
; Accomodate latest Media changes.
; https://drupal.org/node/2159403
projects[ckeditor][patch][] = "https://drupal.org/files/issues/ckeditor-accomodate-latest-media-changes-0.patch"
; Remove redundant external plugin declarations.
; https://drupal.org/comment/8284591#comment-8284591
projects[ckeditor][patch][] = "https://drupal.org/files/issues/ckeditor-remove-external-plugin-declarations-1-alt.patch"
projects[ctools][type] = "module"
projects[ctools][subdir] = "contrib"
projects[ctools][version] = "1.4"
projects[ctools][download][type] = "git"
projects[ctools][download][url] = "http://git.drupal.org/project/ctools.git"
projects[ctools][download][branch] = "7.x-1.x"
projects[ctools][download][revision] = "e720f61d"
projects[custom_search][type] = "module"
projects[custom_search][subdir] = "contrib"
projects[custom_search][download][type] = "git"
projects[custom_search][download][url] = "http://git.drupal.org/project/custom_search.git"
projects[custom_search][download][branch] = "7.x-1.x"
projects[custom_search][download][revision] = "20144e64494c83a448067d587e59df5d7e4780bb"
projects[custom_search][version] = "1.16"
; Avoid akward sanitization of user-entered search strings.
; https://drupal.org/node/2012210
projects[custom_search][patch][] = "http://drupal.org/files/commons_search_js_encode.patch"
projects[date][type] = "module"
projects[date][subdir] = "contrib"
projects[date][version] = "2.7"
@ -89,24 +110,29 @@ projects[diff][type] = "module"
projects[diff][subdir] = "contrib"
projects[diff][version] = "3.2"
; Profile has no recommended release.
projects[edit_profile][type] = "module"
projects[edit_profile][subdir] = "contrib"
projects[edit_profile][version] = "1.0-beta2"
projects[elements][type] = "module"
projects[elements][subdir] = "contrib"
projects[elements][version] = "1.4"
projects[email_registration][type] = "module"
projects[email_registration][subdir] = "contrib"
projects[email_registration][version] = "1.1"
projects[email_registration][download][type] = "git"
projects[email_registration][download][url] = "http://git.drupal.org/project/email_registration.git"
projects[email_registration][download][branch] = "7.x-1.x"
projects[email_registration][download][revision] = "1656416"
projects[entity][type] = "module"
projects[entity][subdir] = "contrib"
projects[entity][version] = "1.3"
; Force LANGUAGE_NONE entities to still display within rendered entities.
; http://drupal.org/node/1782134
projects[entity][patch][] = "http://drupal.org/files/entity-translatable_fields_not_overriding_und_with_empty_values.patch"
projects[entity][version] = "1.5"
projects[entitycache][type] = "module"
projects[entitycache][subdir] = "contrib"
projects[entitycache][download][type] = "git"
projects[entitycache][download][url] = "http://git.drupal.org/project/entitycache.git"
projects[entitycache][download][branch] = "7.x-1.x"
projects[entitycache][download][revision] = "7e390b5"
projects[entitycache][version] = "1.2"
; Fix core translation support.
; http://drupal.org/node/1349566#comment-7781063
@ -114,62 +140,104 @@ projects[entitycache][patch][] = "http://drupal.org/files/add-translation-inform
projects[entityreference][type] = "module"
projects[entityreference][subdir] = "contrib"
projects[entityreference][download][type] = "git"
projects[entityreference][download][url] = "http://git.drupal.org/project/entityreference.git"
projects[entityreference][download][branch] = "7.x-1.x"
projects[entityreference][download][revision] = "1c176daef3e7483389cbebeb34784b3af6521f7f"
; Profile has no recommended release
projects[edit_profile][type] = "module"
projects[edit_profile][subdir] = "contrib"
projects[edit_profile][version] = "1.0-beta2"
projects[entityreference][version] = "1.1"
projects[entityreference_prepopulate][type] = "module"
projects[entityreference_prepopulate][subdir] = "contrib"
projects[entityreference_prepopulate][version] = "1.3"
projects[entityreference_prepopulate][version] = "1.5"
projects[entity_translation][type] = "module"
projects[entity_translation][subdir] = "contrib"
projects[entity_translation][version] = "1.0-beta3"
projects[facetapi][type] = "module"
projects[facetapi][subdir] = "contrib"
projects[facetapi][version] = "1.3"
projects[features][type] = "module"
projects[features][subdir] = "contrib"
projects[features][version] = "2.0-rc3"
projects[features][version] = "2.0"
; Issue #1921982: Add 'customized' to the fields we check when comparing a menu_link feature
; http://drupal.org/node/1921982
projects[features][patch][] = "http://drupal.org/files/menu_links_customized-927576-8.patch"
projects[file_entity][type] = "module"
projects[file_entity][subdir] = "contrib"
projects[file_entity][version] = "2.0-alpha3"
; Issue #2081713: Fix undefined index errors with empty (remote) files.
; https://drupal.org/node/2081713
projects[file_entity][patch][] = "https://drupal.org/files/issues/add-filesize-checks-2081713-13.patch"
projects[flag][type] = "module"
projects[flag][subdir] = "contrib"
projects[flag][version] = "2.1"
projects[flag][version] = "2.2"
; Issue #1965760: Manually set taxonomy term flag types because its different.
; http://drupal.org/node/1965760
projects[flag][patch][] = "http://drupal.org/files/1965760-flag-taxonomy-types.patch"
projects[flag][patch][] = "https://drupal.org/files/issues/1965760.29.flag_.entity-tokens.patch"
projects[flag_abuse][type] = "module"
projects[flag_abuse][subdir] = "contrib"
projects[flag_abuse][version] = "2.0-alpha1"
projects[flag_abuse][version] = "2.0"
projects[redirect][type] = "module"
projects[redirect][subdir] = "contrib"
projects[redirect][version] = "1.0-rc1"
projects[gravatar][type] = "module"
projects[gravatar][subdir] = "contrib"
projects[gravatar][download][type] = "git"
projects[gravatar][download][url] = "http://git.drupal.org/project/gravatar.git"
projects[gravatar][download][branch] = "7.x-1.x"
projects[gravatar][download][revision] = "bb2f81e6"
projects[http_client][type] = "module"
projects[http_client][subdir] = "contrib"
projects[http_client][version] = "2.4"
projects[admin_icons][type] = "module"
projects[admin_icons][subdir] = "contrib"
projects[admin_icons][download][type] = "git"
projects[admin_icons][download][url] = "http://git.drupal.org/project/admin_icons.git"
projects[admin_icons][download][branch] = "7.x-1.x"
projects[admin_icons][download][revision] = "60d9f28801533fecc92216a60d444d89d80e7611"
projects[i18n][type] = "module"
projects[i18n][subdir] = "contrib"
projects[i18n][version] = "1.11"
projects[i18nviews][type] = "module"
projects[i18nviews][subdir] = "contrib"
projects[i18nviews][download][type] = "git"
projects[i18nviews][download][url] = "http://git.drupal.org/project/i18nviews.git"
projects[i18nviews][download][branch] = "7.x-3.x"
projects[i18nviews][download][revision] = "26bd52c"
projects[kissmetrics][type] = "module"
projects[kissmetrics][subdir] = "contrib"
projects[kissmetrics][version] = "1.0-rc3"
projects[l10n_update][type] = "module"
projects[l10n_update][subdir] = "contrib"
projects[l10n_update][version] = "1.0"
projects[libraries][type] = "module"
projects[libraries][subdir] = "contrib"
projects[libraries][version] = "2.1"
projects[libraries][version] = "2.2"
projects[lingotek][type] = "module"
projects[lingotek][subdir] = "contrib"
projects[lingotek][version] = "5.06"
projects[link][type] = "module"
projects[link][subdir] = "contrib"
projects[link][version] = "1.1"
projects[link][version] = "1.2"
projects[media][type] = "module"
projects[media][subdir] = "contrib"
projects[media][download][type] = "git"
projects[media][download][url] = "http://git.drupal.org/project/media.git"
projects[media][download][branch] = "7.x-2.x"
projects[media][download][revision] = "b2c2d78"
; New filelfield browser widget is massively confusing the user
; https://drupal.org/comment/8570379#comment-8570379
projects[media][patch][] = "https://drupal.org/files/issues/automatically-attach-files-2216329-2.patch"
projects[media_oembed][type] = "module"
projects[media_oembed][subdir] = "contrib"
projects[media_oembed][version] = "2.1"
projects[memcache][type] = "module"
projects[memcache][subdir] = "contrib"
projects[memcache][version] = "1.0"
projects[menu_attributes][type] = "module"
projects[menu_attributes][subdir] = "contrib"
@ -183,30 +251,21 @@ projects[message][version] = "1.9"
; http://drupal.org/node/1920560#comment-7080942
projects[message][patch][] = "http://drupal.org/files/1920560-message-access-alterable.patch"
; Add support for the undefined language.
; http://drupal.org/node/2006702#comment-7842259
projects[message][patch][] = "http://drupal.org/files/message_field_undefined-lang.2006702-14.patch"
projects[message_notify][type] = "module"
projects[message_notify][subdir] = "contrib"
projects[message_notify][download][type] = "git"
projects[message_notify][download][url] = "http://git.drupal.org/project/message_notify.git"
projects[message_notify][download][branch] = "7.x-2.x"
projects[message_notify][download][revision] = "e546b0a6e3d2dfd48f4fd3a4d45806c066c9a9bc"
projects[message_notify][version] = "2.5"
projects[message_subscribe][type] = "module"
projects[message_subscribe][subdir] = "contrib"
projects[message_subscribe][download][type] = "git"
projects[message_subscribe][download][url] = "http://git.drupal.org/project/message_subscribe.git"
projects[message_subscribe][download][branch] = "7.x-1.x"
projects[memcache][type] = "module"
projects[memcache][subdir] = "contrib"
projects[memcache][version] = "1.0"
projects[message_subscribe][version] = "1.0-rc2"
projects[metatag][type] = "module"
projects[metatag][subdir] = "contrib"
projects[metatag][version] = "1.0-beta7"
; Support for rel=author link in head.
; http://drupal.org/node/1865228#comment-6839604
projects[metatag][patch][] = "http://drupal.org/files/metatag-n1865228-3.patch"
projects[metatag][version] = "1.0-beta9"
projects[module_filter][type] = "module"
projects[module_filter][subdir] = "contrib"
@ -214,130 +273,164 @@ projects[module_filter][version] = "1.8"
projects[mollom][type] = "module"
projects[mollom][subdir] = "contrib"
projects[mollom][version] = "2.7"
projects[mollom][version] = "2.10"
projects[navbar][type] = "module"
projects[navbar][subdir] = "contrib"
projects[navbar][download][type] = "git"
projects[navbar][download][url] = "http://git.drupal.org/project/navbar.git"
projects[navbar][download][branch] = "7.x-1.x"
projects[navbar][download][revision] = "dd542e1a74d9c9b3a9b5bd699aad9a4b65e5c5b7"
projects[navbar][version] = "1.4"
; Change I-beam cursors in the navbar to be a pointer instead.
; https://drupal.org/node/2173041
projects[navbar][patch][] = "https://drupal.org/files/issues/2173041-3-i-beam-menu-hover.patch"
projects[oauth][type] = "module"
projects[oauth][subdir] = "contrib"
projects[oauth][version] = "3.1"
projects[oauth][version] = "3.2"
projects[oauthconnector][type] = "module"
projects[oauthconnector][subdir] = "contrib"
projects[oauthconnector][download][type] = "git"
projects[oauthconnector][download][url] = "http://git.drupal.org/project/oauthconnector.git"
projects[oauthconnector][download][branch] = "7.x-1.x"
projects[oauthconnector][download][revision] = "0ce7ac9614710c0f68d0a58cb4ae4667f8bd6fa7"
projects[oauthconnector][download][revision] = "42c6f66"
projects[oembed][type] = "module"
projects[oembed][subdir] = "contrib"
projects[oembed][download][type] = "git"
projects[oembed][download][url] = "http://git.drupal.org/project/oembed.git"
projects[oembed][download][branch] = "7.x-1.x"
projects[oembed][download][revision] = "9aa5303"
projects[og][type] = "module"
projects[og][subdir] = "contrib"
projects[og][version] = "2.4"
projects[og][version] = "2.7"
; Auto-assign role to group manager broken on groups with overridden roles.
; https://drupal.org/node/2005800#comment-7684873
projects[og][patch][] = "http://drupal.org/files/og-default-role-member-2005800-21.patch"
projects[og][patch][] = "http://drupal.org/files/issues/og-default-role-member-2005800-25.patch"
; og_ui should give users the theme, not admin ui when creating groups
; og_ui should give users the theme, not admin ui when creating groups.
; http://drupal.org/node/1800208
projects[og][patch][] = "http://drupal.org/files/og_ui-group_node_add_theme-1800208-5.patch"
; _og_access_verify_access_field_existence() assumes node group type, throws an exception rebuilding node access.
;projects[og][patch][] = "http://drupal.org/files/og-access-rebuild-exception-group-type.patch"
projects[panelizer][type] = "module"
projects[panelizer][subdir] = "contrib"
projects[panelizer][version] = "3.1"
projects[panels][type] = "module"
projects[panels][subdir] = "contrib"
projects[panels][version] = "3.3"
; Fatal error: Call to undefined function panels_get_layouts()
; http://drupal.org/node/1828684#comment-6694732
projects[panels][patch][] = "http://drupal.org/files/1828684-layout-fix-6.patch"
; PHP 5.3.9 Strict Warning on Panels Empty Value
; http://drupal.org/node/1632898#comment-6412840
projects[panels][patch][] = "http://drupal.org/files/panels-n1632898-15.patch"
; Add internationalization support.
; http://drupal.org/node/1179034#comment-7216342
projects[panels][patch][] = "http://drupal.org/files/panels-1179034-41_____panels-uuids-127790-100__-80.patch"
projects[panels][download][type] = "git"
projects[panels][download][url] = "http://git.drupal.org/project/panels.git"
projects[panels][download][branch] = "7.x-3.x"
projects[panels][download][revision] = "8059bda2b"
projects[paranoia][type] = "module"
projects[paranoia][subdir] = "contrib"
projects[paranoia][version] = "1.2"
projects[paranoia][version] = "1.3"
projects[pathauto][type] = "module"
projects[pathauto][subdir] = "contrib"
projects[pathauto][version] = "1.2"
projects[placeholder][type] = "module"
projects[placeholder][subdir] = "contrib"
projects[placeholder][version] = "1.0"
projects[picture][type] = "module"
projects[picture][subdir] = "contrib"
projects[picture][download][type] = "git"
projects[picture][download][url] = "http://git.drupal.org/project/picture.git"
projects[picture][download][branch] = "7.x-1.x"
projects[picture][download][revision] = "18b94b9"
; Add ctools as a dependency
; https://drupal.org/node/2173043
projects[picture][patch][] = "https://drupal.org/files/issues/add-ctools-dependency-2173043-1.patch"
; Allow filter tips to be translated
; https://drupal.org/node/2139459
projects[picture][patch][] = "https://drupal.org/files/issues/translate-filter-tips-2139459-1.patch"
; Move hook_uninstall() to picture.install to fix issues on uninstall.
; https://drupal.org/node/2173015
projects[picture][patch][] = "https://drupal.org/files/issues/move-uninstall-hook-implementation-2173015-1.patch"
; Remove implementation of hook_file_formatter_info() to remove duplicate file formatter.
; https://drupal.org/node/2172841
projects[picture][patch][] = "https://drupal.org/files/issues/remove-file-formatter-hook-implementation-2172831-1.patch"
; Remove implementation of hook_ctools_plugin_api() to fix issues with features.
; https://drupal.org/node/2172831
projects[picture][patch][] = "https://drupal.org/files/issues/remove-ctools-hook-implementation-2172831-1.patch"
projects[pm_existing_pages][type] = "module"
projects[pm_existing_pages][subdir] = "contrib"
projects[pm_existing_pages][version] = "1.4"
projects[potx][type] = "module"
projects[potx][subdir] = "contrib"
projects[potx][version] = "1.0"
projects[privatemsg][type] = "module"
projects[privatemsg][subdir] = "contrib"
projects[privatemsg][version] = "1.4"
; Add preliminary Views integration
; Add preliminary Views integration.
; http://drupal.org/node/1573000
projects[privatemsg][patch][] = "http://drupal.org/files/privatemsg-1573000-64.patch"
; Enable privatemsg_realname when realname is enabled
; Enable privatemsg_realname when realname is enabled.
; https://drupal.org/node/2070719
projects[privatemsg][patch][] = "http://drupal.org/files/2077223-privatemsg-realname-enabled-1.patch"
projects[quicktabs][type] = "module"
projects[quicktabs][subdir] = "contrib"
projects[quicktabs][download][type] = "git"
projects[quicktabs][download][url] = "http://git.drupal.org/project/quicktabs.git"
projects[quicktabs][download][branch] = "7.x-3.x"
projects[quicktabs][download][revision] = "89f7fd0b7313782d0f7504996daa36bde798ec79"
projects[radioactivity][type] = "module"
projects[radioactivity][subdir] = "contrib"
projects[radioactivity][download][type] = "git"
projects[radioactivity][download][url] = "http://git.drupal.org/project/radioactivity.git"
projects[radioactivity][download][branch] = "7.x-2.x"
projects[radioactivity][download][revision] = "aee21dbed4f54d0e626e3c19ecc550bf1ec656f6"
; Radioactivity not compatible with Memcache module
; http://drupal.org/node/1860216
projects[radioactivity][patch][] = "http://drupal.org/files/radioactivity-memcache.patch"
projects[quicktabs][version] = "3.6"
projects[quicktabs][patch][] = "http://drupal.org/files/2104643-revert-qt-487518-5.patch"
projects[r4032login][type] = "module"
projects[r4032login][subdir] = "contrib"
projects[r4032login][version] = "1.6"
projects[r4032login][version] = "1.7"
projects[radioactivity][type] = "module"
projects[radioactivity][subdir] = "contrib"
projects[radioactivity][version] = "2.9"
projects[rate][type] = "module"
projects[rate][subdir] = "contrib"
projects[rate][version] = "1.6"
projects[rate][version] = "1.7"
; Add widget to node/comment $links
; Add widget to node/comment $links.
; http://drupal.org/node/947516#comment-6979780
projects[rate][patch][] = "http://drupal.org/files/947516-rate-node-links-15.patch"
; Only load CSS when necessary.
; https://drupal.org/node/2180853
projects[rate][patch][] = "https://drupal.org/files/issues/attach-rate-css-2180853-3.patch"
projects[realname][type] = "module"
projects[realname][subdir] = "contrib"
projects[realname][version] = "1.1"
projects[realname][version] = "1.2"
; Realname entityreference autocomplete API update
; https://drupal.org/node/2225889
projects[realname][patch][] = "https://drupal.org/files/issues/2225889-realname-correct-menu-2.patch"
projects[redirect][type] = "module"
projects[redirect][subdir] = "contrib"
projects[redirect][version] = "1.0-rc1"
projects[registration][subdir] = "contrib"
projects[registration][type] = "module"
projects[registration][version] = "1.2"
projects[registration][version] = "1.3"
projects[rich_snippets][type] = "module"
projects[rich_snippets][subdir] = "contrib"
projects[rich_snippets][version] = "1.0-beta3"
projects[rules][type] = "module"
projects[rules][subdir] = "contrib"
projects[rules][version] = "2.3"
projects[rules][version] = "2.7"
projects[schemaorg][type] = "module"
projects[schemaorg][subdir] = "contrib"
projects[schemaorg][version] = "1.0-beta4"
projects[search_facetapi][type] = "module"
projects[search_facetapi][subdir] = "contrib"
@ -345,23 +438,11 @@ projects[search_facetapi][version] = "1.0-beta2"
projects[sharethis][type] = "module"
projects[sharethis][subdir] = "contrib"
projects[sharethis][version] = "2.5"
projects[sharethis][version] = "2.6"
projects[facetapi][type] = "module"
projects[facetapi][subdir] = "contrib"
projects[facetapi][version] = "1.3"
projects[rich_snippets][type] = "module"
projects[rich_snippets][subdir] = "contrib"
projects[rich_snippets][version] = "1.0-beta3"
; Remove snippets from non-node type searches:
; http://drupal.org/node/1923904#comment-7094488
projects[rich_snippets][patch][] = "http://drupal.org/files/1923904-search-nodes-only.patch"
projects[schemaorg][type] = "module"
projects[schemaorg][subdir] = "contrib"
projects[schemaorg][version] = "1.0-beta3"
projects[smartcrop][type] = "module"
projects[smartcrop][subdir] = "contrib"
projects[smartcrop][version] = "1.0-beta2"
projects[strongarm][type] = "module"
projects[strongarm][subdir] = "contrib"
@ -372,13 +453,9 @@ projects[strongarm][download][revision] = "5a2326ba67e59923ecce63d9bb5e0ed6548ab
projects[timeago][type] = "module"
projects[timeago][subdir] = "contrib"
projects[timeago][version] = "2.x-dev"
projects[timeago][download][type] = "git"
projects[timeago][download][url] = "http://git.drupal.org/project/timeago.git"
projects[timeago][download][branch] = "7.x-2.x"
projects[timeago][download][revision] = "768ea66"
projects[timeago][version] = "2.2"
; Provide a dedicated date type:
; Provide a dedicated date type.
; http://drupal.org/node/1427226#comment-6638836
projects[timeago][patch][] = "http://drupal.org/files/1427226-timeago-date-type.patch"
@ -390,37 +467,49 @@ projects[token][type] = "module"
projects[token][subdir] = "contrib"
projects[token][version] = "1.5"
projects[translation_helpers][type] = "module"
projects[translation_helpers][subdir] = "contrib"
projects[translation_helpers][version] = "1.0"
projects[variable][type] = "module"
projects[variable][subdir] = "contrib"
projects[variable][version] = "2.5"
projects[views][type] = "module"
projects[views][subdir] = "contrib"
projects[views][version] = "3.7"
projects[views][version] = "3.8"
; Update Views Content access filter per core performance improvements.
; https://drupal.org/comment/8516039#comment-8516039
projects[views][patch][] = "https://drupal.org/files/issues/2204257-views-content-access-filter-core-depends-on-core-patch.patch"
projects[views_bulk_operations][type] = "module"
projects[views_bulk_operations][subdir] = "contrib"
projects[views_bulk_operations][version] = "3.2"
projects[views_field_view][type] = "module"
projects[views_field_view][subdir] = "contrib"
projects[views_field_view][version] = "1.1"
projects[views_load_more][type] = "module"
projects[views_load_more][subdir] = "contrib"
projects[views_load_more][version] = "1.1"
projects[views_bulk_operations][type] = "module"
projects[views_bulk_operations][subdir] = "contrib"
projects[views_bulk_operations][version] = "3.1"
projects[views_litepager][type] = "module"
projects[views_litepager][subdir] = "contrib"
projects[views_litepager][version] = "3.0"
; We have the version of voting api at the top so it doesn't get included in our dev make patch.
projects[votingapi][version] = "2.11"
projects[views_load_more][type] = "module"
projects[views_load_more][subdir] = "contrib"
projects[views_load_more][version] = "1.2"
; Suppress notice error when loading more content from views_load_more.
; https://drupal.org/node/2207467
projects[views_load_more][patch][] = "https://drupal.org/files/issues/fix-notice-undefined-index-2152935-3.patch"
projects[votingapi][type] = "module"
projects[votingapi][subdir] = "contrib"
projects[votingapi][version] = "2.11"
; Registry Rebuild
; We can probably remove this later, but for now keep it included
; See https://drupal.org/node/1983606#comment-7788313 for more information.
projects[registry_rebuild][version] = "1.10"
projects[registry_rebuild][type] = "module"
projects[registry_rebuild][subdir] = "contrib"
projects[voting_rules][type] = "module"
projects[voting_rules][subdir] = "contrib"
projects[voting_rules][version] = "1.0-alpha1"
projects[geophp][version] = "1.7"
projects[geophp][type] = "module"
@ -430,7 +519,7 @@ projects[geocoder][version] = "1.2"
projects[geocoder][type] = "module"
projects[geocoder][subdir] = "contrib"
projects[geofield][version] = "2.0"
projects[geofield][version] = "2.1"
projects[geofield][type] = "module"
projects[geofield][subdir] = "contrib"
@ -442,7 +531,7 @@ projects[leaflet_mapbox][version] = "1.2"
projects[leaflet_mapbox][type] = "module"
projects[leaflet_mapbox][subdir] = "contrib"
projects[leaflet_more_maps][version] = "1.6"
projects[leaflet_more_maps][version] = "1.9"
projects[leaflet_more_maps][type] = "module"
projects[leaflet_more_maps][subdir] = "contrib"
@ -475,44 +564,64 @@ projects[feeds_fetcher_directory][patch][] = "https://drupal.org/files/feeds_fet
projects[zen][type] = "theme"
projects[zen][subdir] = "contrib"
projects[zen][version] = "5.4"
projects[zen][version] = "5.5"
projects[adaptivetheme][type] = "theme"
projects[adaptivetheme][subdir] = "contrib"
projects[adaptivetheme][download][type] = "git"
projects[adaptivetheme][download][url] = "http://git.drupal.org/project/adaptivetheme.git"
projects[adaptivetheme][download][branch] = "7.x-3.x"
projects[adaptivetheme][download][revision] = "b4b38c3c01d066e733c2942020c51962cd64231c"
projects[adaptivetheme][download][revision] = "18693ff59db7cb3171f282a982d04fe6544b63a1"
; Remove link around comment creation date.
; http://drupal.org/node/1427226#comment-6638836
projects[adaptivetheme][patch][] = "http://drupal.org/files/remove-comment-creation-link-2018081-1.patch"
projects[ember][type] = "theme"
projects[ember][subdir] = "contrib"
projects[ember][download][type] = "git"
projects[ember][download][url] = "http://git.drupal.org/project/ember.git"
projects[ember][download][branch] = "7.x-2.x"
projects[ember][download][revision] = "caf4df7"
projects[sky][type] = "theme"
projects[sky][subdir] = "contrib"
projects[sky][version] = "3.0-rc1"
projects[sky][version] = "3.0"
; Libraries.
; NOTE: These need to be listed in http://drupal.org/packaging-whitelist.
libraries[underscore][download][type] = "get"
libraries[underscore][type] = "libraries"
libraries[underscore][download][url] = "https://github.com/jashkenas/underscore/archive/1.4.4.zip"
libraries[backbone][download][type] = "get"
libraries[backbone][type] = "libraries"
libraries[backbone][download][url] = "https://github.com/jashkenas/backbone/archive/1.0.0.tar.gz"
libraries[backbone][download][url] = "https://github.com/jashkenas/backbone/archive/1.1.0.tar.gz"
libraries[ckeditor][download][type] = "get"
libraries[ckeditor][download][url] = "http://download.cksource.com/CKEditor/CKEditor/CKEditor%204.0/ckeditor_4.0_standard.tar.gz"
libraries[ckeditor][download][url] = "http://download.cksource.com/CKEditor/CKEditor/CKEditor%204.3.4/ckeditor_4.3.4_full.zip"
libraries[ckeditor][type] = "libraries"
libraries[ckeditor_lineutils][download][type] = "get"
libraries[ckeditor_lineutils][download][url] = "http://download.ckeditor.com/lineutils/releases/lineutils_4.3.4.zip"
libraries[ckeditor_lineutils][type] = "libraries"
libraries[ckeditor_lineutils][subdir] = "ckeditor/plugins"
libraries[ckeditor_lineutils][directory_name] = "lineutils"
libraries[ckeditor_widget][download][type] = "get"
libraries[ckeditor_widget][download][url] = "http://download.ckeditor.com/widget/releases/widget_4.3.4.zip"
libraries[ckeditor_widget][type] = "libraries"
libraries[ckeditor_widget][subdir] = "ckeditor/plugins"
libraries[ckeditor_widget][directory_name] = "widget"
libraries[modernizr][download][type] = "get"
libraries[modernizr][type] = "libraries"
libraries[modernizr][download][url] = "https://github.com/Modernizr/Modernizr/archive/v2.7.1.tar.gz"
libraries[placeholder][download][type] = "get"
libraries[placeholder][type] = "libraries"
libraries[placeholder][download][url] = "https://github.com/mathiasbynens/jquery-placeholder/archive/v2.0.7.tar.gz"
libraries[timeago][download][type] = "get"
libraries[timeago][type] = "libraries"
libraries[timeago][download][url] = "https://raw.github.com/rmm5t/jquery-timeago/v1.4.0/jquery.timeago.js"
libraries[timeago][download][url] = "https://raw.github.com/rmm5t/jquery-timeago/v1.4.1/jquery.timeago.js"
libraries[underscore][download][type] = "get"
libraries[underscore][type] = "libraries"
libraries[underscore][download][url] = "https://github.com/jashkenas/underscore/archive/1.5.2.zip"
libraries[leaflet][download][type] = "get"
libraries[leaflet][type] = "libraries"

View File

@ -5,7 +5,7 @@ description = Ready-to-use solution for managing OpenStack communities.
core = 7.x
php_memory_limit = 192M
; Core modules.
; Install required core modules.
dependencies[] = block
dependencies[] = comment
dependencies[] = dblog
@ -14,30 +14,37 @@ dependencies[] = field_ui
dependencies[] = file
dependencies[] = image
dependencies[] = list
dependencies[] = locale
dependencies[] = menu
dependencies[] = number
dependencies[] = options
dependencies[] = path
dependencies[] = rdf
dependencies[] = search
dependencies[] = shortcut
dependencies[] = taxonomy
; Contributed modules.
; Install required contributed modules.
dependencies[] = addressfield
dependencies[] = addressfield_tokens
dependencies[] = breakpoints
dependencies[] = ckeditor
dependencies[] = ctools
dependencies[] = custom_search
dependencies[] = diff
dependencies[] = elements
dependencies[] = email_registration
dependencies[] = entity
dependencies[] = entityreference
dependencies[] = entitycache
dependencies[] = edit_profile
dependencies[] = features
dependencies[] = file_entity
dependencies[] = flag
dependencies[] = http_client
dependencies[] = libraries
dependencies[] = media
dependencies[] = media_internet
dependencies[] = media_wysiwyg
dependencies[] = menu_attributes
dependencies[] = message
dependencies[] = message_notify
@ -45,20 +52,22 @@ dependencies[] = message_subscribe
dependencies[] = metatag
dependencies[] = module_filter
dependencies[] = navbar
dependencies[] = media_oembed
dependencies[] = og
dependencies[] = panelizer
dependencies[] = panels
dependencies[] = panels_ipe
dependencies[] = paranoia
dependencies[] = pathauto
dependencies[] = placeholder
dependencies[] = privatemsg
dependencies[] = privatemsg_realname
dependencies[] = quicktabs
dependencies[] = r4032login
dependencies[] = libraries
dependencies[] = radioactivity
dependencies[] = realname
dependencies[] = redirect
dependencies[] = rules
dependencies[] = schemaorg
dependencies[] = sharethis
dependencies[] = strongarm
dependencies[] = token
@ -66,38 +75,50 @@ dependencies[] = views
dependencies[] = views_bulk_operations
dependencies[] = views_ui
dependencies[] = votingapi
dependencies[] = advancedqueue
dependencies[] = ckeditor
; Install commons specific modules
dependencies[] = commons_activity_streams
dependencies[] = commons_bw
dependencies[] = commons_content_moderation
dependencies[] = commons_events
dependencies[] = commons_events_pages
dependencies[] = commons_featured
dependencies[] = commons_follow
dependencies[] = commons_follow_group
dependencies[] = commons_follow_node
dependencies[] = commons_follow_term
dependencies[] = commons_follow_user
dependencies[] = commons_follow_ui
dependencies[] = commons_like
dependencies[] = commons_search
dependencies[] = commons_search_core
dependencies[] = commons_follow_user
dependencies[] = commons_groups
dependencies[] = commons_groups_pages
dependencies[] = commons_like
dependencies[] = commons_location
dependencies[] = commons_media
dependencies[] = commons_misc
dependencies[] = commons_notify
dependencies[] = commons_polls
dependencies[] = commons_posts
dependencies[] = commons_pages
dependencies[] = commons_content_moderation
dependencies[] = commons_profile_base
dependencies[] = commons_profile_social
dependencies[] = commons_utility_links
dependencies[] = commons_user_profile_pages
dependencies[] = commons_activity_page
dependencies[] = commons_misc
dependencies[] = commons_location
dependencies[] = commons_wysiwyg
dependencies[] = commons_q_a
dependencies[] = commons_search
dependencies[] = commons_search_core
dependencies[] = commons_social_sharing
dependencies[] = commons_trusted_contacts
dependencies[] = commons_utility_links
dependencies[] = commons_wysiwyg
; Disabled commons modules
;dependencies[] = commons_activity_page
;dependencies[] = commons_events_pages
;dependencies[] = commons_groups_directory
;dependencies[] = commons_groups_pages
;dependencies[] = commons_pages
;dependencies[] = commons_q_a_pages
;dependencies[] = commons_site_homepage
;dependencies[] = commons_trusted_contacts
;dependencies[] = commons_user_profile_pages
;dependencies[] = commons_wikis
;dependencies[] = commons_wikis_pages
; Install Groups dependencies
dependencies[] = geophp
dependencies[] = geocoder
dependencies[] = geofield
@ -109,6 +130,7 @@ dependencies[] = job_scheduler
dependencies[] = feeds
dependencies[] = drush_feeds_import
dependencies[] = feeds_ui
dependencies[] = feeds_fetcher_directory
; Custom modules
dependencies[] = field_property_list

View File

@ -82,17 +82,17 @@ function groups_install() {
drupal_write_record('block', $search_block);
// Create a default role for site administrators, with all available permissions assigned.
$admin_role = new stdClass();
$admin_role->name = 'administrator';
$admin_role->weight = 2;
user_role_save($admin_role);
// $admin_role = new stdClass();
// $admin_role->name = 'administrator';
// $admin_role->weight = 2;
// user_role_save($admin_role);
// Set this as the administrator role.
variable_set('user_admin_role', $admin_role->rid);
// Assign user 1 the "administrator" role.
db_insert('users_roles')
->fields(array('uid' => 1, 'rid' => $admin_role->rid))
->execute();
// db_insert('users_roles')
// ->fields(array('uid' => 1, 'rid' => $admin_role->rid))
// ->execute();
// AdaptiveTheme requires that the system theme settings form
// be submitted in order for its themes' settings to be properly set

View File

@ -5,6 +5,33 @@
*/
define('DRUPAL_MINIMUM_MAX_EXECUTION_TIME', 120);
/**
* Get Commons entity integration information.
*
* @param $entity_type
* (optional) The entity type to load, e.g. node or user.
*
* @return
* An associative array of entity integrations whose keys define the entity
* type for each integration and whose values contain the bundles which have
* been integrated. Each bundle is itself an associative array, whose keys
* define the type of integration to enable and whose values contain the
* status of the integration. TRUE = enabled, FALSE = disabled.
*/
function commons_entity_integration_info($entity_type = NULL) {
$info = &drupal_static(__FUNCTION__);
if (!$info) {
$info = module_invoke_all('commons_entity_integration');
drupal_alter('commons_entity_integration', $info);
}
if ($entity_type) {
return isset($info[$entity_type]) ? $info[$entity_type] : array();
}
else {
return $info;
}
}
/**
* Implements hook_admin_paths_alter().
*/

View File

@ -0,0 +1,14 @@
<?php
/**
* @file
* commons_activity_page.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function commons_activity_page_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "page_manager" && $api == "pages_default") {
return array("version" => "1");
}
}

View File

@ -0,0 +1,11 @@
name = Commons Activity Page
description = Allows users to view a stream of site-wide and personalized activity.
core = 7.x
package = Commons - Landing pages
dependencies[] = commons_activity_streams
dependencies[] = commons_featured
dependencies[] = ctools
dependencies[] = page_manager
features[ctools][] = page_manager:pages_default:1
features[features_api][] = api:2
features[page_manager_pages][] = commons_activity_streams_activity

View File

@ -0,0 +1,7 @@
<?php
/**
* @file
* Code for the Commons Activity Page feature.
*/
include_once 'commons_activity_page.features.inc';

View File

@ -0,0 +1,130 @@
<?php
/**
* @file
* commons_activity_page.pages_default.inc
*/
/**
* Implements hook_default_page_manager_pages().
*/
function commons_activity_page_default_page_manager_pages() {
$page = new stdClass();
$page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
$page->api_version = 1;
$page->name = 'commons_activity_streams_activity';
$page->task = 'page';
$page->admin_title = 'Activity';
$page->admin_description = '';
$page->path = 'activity';
$page->access = array(
'type' => 'none',
'settings' => NULL,
);
$page->menu = array();
$page->arguments = array();
$page->conf = array(
'admin_paths' => FALSE,
);
$page->default_handlers = array();
$handler = new stdClass();
$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
$handler->api_version = 1;
$handler->name = 'page_commons_activity_streams_activity_panel_context';
$handler->task = 'page';
$handler->subtask = 'commons_activity_streams_activity';
$handler->handler = 'panel_context';
$handler->weight = 0;
$handler->conf = array(
'title' => 'Activity',
'no_blocks' => 0,
'pipeline' => 'ipe',
'body_classes_to_remove' => '',
'body_classes_to_add' => '',
'css_id' => '',
'css' => '',
'contexts' => array(),
'relationships' => array(),
);
$display = new panels_display();
$display->layout = 'two_66_33';
$display->layout_settings = array();
$display->panel_settings = array(
'style_settings' => array(
'default' => NULL,
'two_66_33_top' => NULL,
'two_66_33_first' => NULL,
'two_66_33_second' => NULL,
'two_66_33_bottom' => NULL,
),
);
$display->cache = array();
$display->title = 'Recent site activity';
$display->uuid = '5421dc96-4e35-5794-5539-fc6123374548';
$display->content = array();
$display->panels = array();
$pane = new stdClass();
$pane->pid = 'new-6251a6df-20d2-5034-f9d8-a66cd04f16e9';
$pane->panel = 'two_66_33_first';
$pane->type = 'views_panes';
$pane->subtype = 'commons_activity_streams_activity-panel_pane_3';
$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 = '6251a6df-20d2-5034-f9d8-a66cd04f16e9';
$display->content['new-6251a6df-20d2-5034-f9d8-a66cd04f16e9'] = $pane;
$display->panels['two_66_33_first'][0] = 'new-6251a6df-20d2-5034-f9d8-a66cd04f16e9';
$pane = new stdClass();
$pane->pid = 'new-6668ecda-9f18-0744-71cb-afcb5fb5114d';
$pane->panel = 'two_66_33_second';
$pane->type = 'views_panes';
$pane->subtype = 'commons_featured-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 = '6668ecda-9f18-0744-71cb-afcb5fb5114d';
$display->content['new-6668ecda-9f18-0744-71cb-afcb5fb5114d'] = $pane;
$display->panels['two_66_33_second'][0] = 'new-6668ecda-9f18-0744-71cb-afcb5fb5114d';
$pane = new stdClass();
$pane->pid = 'new-e5d75ae1-dae7-bb04-0977-6e6c5a230f3d';
$pane->panel = 'two_66_33_second';
$pane->type = 'views_panes';
$pane->subtype = 'commons_groups_contributors-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 = 1;
$pane->locks = array();
$pane->uuid = 'e5d75ae1-dae7-bb04-0977-6e6c5a230f3d';
$display->content['new-e5d75ae1-dae7-bb04-0977-6e6c5a230f3d'] = $pane;
$display->panels['two_66_33_second'][1] = 'new-e5d75ae1-dae7-bb04-0977-6e6c5a230f3d';
$display->hide_title = PANELS_TITLE_FIXED;
$display->title_pane = 'new-6251a6df-20d2-5034-f9d8-a66cd04f16e9';
$handler->conf['display'] = $display;
$page->default_handlers[$handler->name] = $handler;
$pages['commons_activity_streams_activity'] = $page;
return $pages;
}

View File

@ -0,0 +1,210 @@
<?php
/**
* @file
* commons_activity_streams.features.field_instance.inc
*/
/**
* Implements hook_field_default_field_instances().
*/
function commons_activity_streams_field_default_field_instances() {
$field_instances = array();
// Exported field_instance: 'message-commons_activity_streams_comment_created-field_target_comments'
$field_instances['message-commons_activity_streams_comment_created-field_target_comments'] = array(
'bundle' => 'commons_activity_streams_comment_created',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'message_notify_email_body' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'message_notify_email_subject' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'message',
'field_name' => 'field_target_comments',
'label' => 'Target comment',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'entityreference',
'settings' => array(
'match_operator' => 'CONTAINS',
'path' => '',
'size' => 60,
),
'type' => 'entityreference_autocomplete',
'weight' => 1,
),
);
// Exported field_instance: 'message-commons_activity_streams_comment_created-field_target_nodes'
$field_instances['message-commons_activity_streams_comment_created-field_target_nodes'] = array(
'bundle' => 'commons_activity_streams_comment_created',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'settings' => array(),
'type' => 'hidden',
'weight' => 1,
),
'message_notify_email_body' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'message_notify_email_subject' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'message',
'field_name' => 'field_target_nodes',
'label' => 'Target nodes',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'entityreference',
'settings' => array(
'match_operator' => 'CONTAINS',
'path' => '',
'size' => 60,
),
'type' => 'entityreference_autocomplete',
'weight' => 3,
),
);
// Exported field_instance: 'message-commons_activity_streams_node_created-field_target_nodes'
$field_instances['message-commons_activity_streams_node_created-field_target_nodes'] = array(
'bundle' => 'commons_activity_streams_node_created',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'settings' => array(),
'type' => 'hidden',
'weight' => 2,
),
'message_notify_email_body' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'message_notify_email_subject' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'message',
'field_name' => 'field_target_nodes',
'label' => 'Target nodes',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'entityreference',
'settings' => array(
'match_operator' => 'CONTAINS',
'path' => '',
'size' => 60,
),
'type' => 'entityreference_autocomplete',
'weight' => 3,
),
);
// Exported field_instance: 'message-commons_activity_streams_user_profile_updated-field_target_users'
$field_instances['message-commons_activity_streams_user_profile_updated-field_target_users'] = array(
'bundle' => 'commons_activity_streams_user_profile_updated',
'default_value' => NULL,
'default_value_function' => '',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 2,
),
'message_notify_email_body' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'message_notify_email_subject' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'message',
'field_name' => 'field_target_users',
'label' => 'Target users',
'required' => 0,
'settings' => array(
'behaviors' => array(
'prepopulate' => array(
'status' => 0,
),
),
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'entityreference',
'settings' => array(
'match_operator' => 'CONTAINS',
'path' => '',
'size' => 60,
),
'type' => 'entityreference_autocomplete',
'weight' => 42,
),
);
// Translatables
// Included for use with string extractors like potx.
t('Target comment');
t('Target nodes');
t('Target users');
return $field_instances;
}

View File

@ -0,0 +1,111 @@
<?php
/**
* @file
* commons_activity_streams.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function commons_activity_streams_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}
/**
* Implements hook_views_api().
*/
function commons_activity_streams_views_api($module = NULL, $api = NULL) {
return array("api" => "3.0");
}
/**
* Implements hook_default_message_type().
*/
function commons_activity_streams_default_message_type() {
$items = array();
$items['commons_activity_streams_comment_created'] = entity_import('message_type', '{
"name" : "commons_activity_streams_comment_created",
"description" : "commons_activity_streams_comment_created",
"argument_keys" : [],
"argument" : [],
"category" : "message_type",
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
"language" : "",
"arguments" : null,
"message_text" : { "und" : [
{
"value" : "[message:user:picture:35x35]",
"format" : "filtered_html",
"safe_value" : "[message:user:picture:35x35]"
},
{
"value" : "\\u003Ca href=\\u0022[message:user:url:absolute]\\u0022\\u003E[message:user:name]\\u003C\\/a\\u003E commented on \\u003Ca href=\\u0022[message:field-target-nodes:0:url]\\u0022\\u003E[message:field-target-nodes:0:title_field]\\u003C\\/a\\u003E",
"format" : "full_html",
"safe_value" : "\\u003Ca href=\\u0022[message:user:url:absolute]\\u0022\\u003E[message:user:name]\\u003C\\/a\\u003E commented on \\u003Ca href=\\u0022[message:field-target-nodes:0:url]\\u0022\\u003E[message:field-target-nodes:0:title_field]\\u003C\\/a\\u003E"
},
{
"value" : "[commons-groups:in-groups-text]",
"format" : "full_html",
"safe_value" : "[commons-groups:in-groups-text]"
}
]
},
"rdf_mapping" : []
}');
$items['commons_activity_streams_node_created'] = entity_import('message_type', '{
"name" : "commons_activity_streams_node_created",
"description" : "commons_activity_streams_node_created",
"argument_keys" : [],
"argument" : [],
"category" : "message_type",
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
"language" : "",
"arguments" : null,
"message_text" : { "und" : [
{
"value" : "[message:user:picture:35x35]",
"format" : "filtered_html",
"safe_value" : "[message:user:picture:35x35]"
},
{
"value" : "\\u003Ca href=\\u0022[message:user:url:absolute]\\u0022\\u003E[message:user:name]\\u003C\\/a\\u003E created \\u003Ca href=\\u0022[message:field-target-nodes:0:url]\\u0022\\u003E[message:field-target-nodes:0:title_field]\\u003C\\/a\\u003E",
"format" : "full_html",
"safe_value" : "\\u003Ca href=\\u0022[message:user:url:absolute]\\u0022\\u003E[message:user:name]\\u003C\\/a\\u003E created \\u003Ca href=\\u0022[message:field-target-nodes:0:url]\\u0022\\u003E[message:field-target-nodes:0:title_field]\\u003C\\/a\\u003E"
},
{
"value" : "[commons-groups:in-groups-text]",
"format" : "full_html",
"safe_value" : "[commons-groups:in-groups-text]"
}
]
},
"rdf_mapping" : []
}');
$items['commons_activity_streams_user_profile_updated'] = entity_import('message_type', '{
"name" : "commons_activity_streams_user_profile_updated",
"description" : "commons_activity_streams_user_profile_updated",
"argument_keys" : [],
"argument" : [],
"category" : "message_type",
"data" : { "purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" } },
"language" : "",
"arguments" : null,
"message_text" : { "und" : [
{
"value" : "[message:user:picture:35x35]",
"format" : "filtered_html",
"safe_value" : "[message:user:picture:35x35]"
},
{
"value" : "\\u003Ca href=\\u0022[message:user:url:absolute]\\u0022\\u003E[message:user:name]\\u003C\\/a\\u003E has an updated profile",
"format" : "full_html",
"safe_value" : "\\u003Ca href=\\u0022[message:user:url:absolute]\\u0022\\u003E[message:user:name]\\u003C\\/a\\u003E has an updated profile"
}
]
},
"rdf_mapping" : []
}');
return $items;
}

View File

@ -0,0 +1,39 @@
name = Commons Activity Streams
core = 7.x
package = Commons - Building blocks
dependencies[] = commons_follow
dependencies[] = ctools
dependencies[] = entity
dependencies[] = entityreference
dependencies[] = features
dependencies[] = message
dependencies[] = strongarm
dependencies[] = timeago
dependencies[] = token
dependencies[] = views
dependencies[] = views_content
dependencies[] = views_load_more
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[field_instance][] = message-commons_activity_streams_comment_created-field_target_comments
features[field_instance][] = message-commons_activity_streams_comment_created-field_target_nodes
features[field_instance][] = message-commons_activity_streams_node_created-field_target_nodes
features[field_instance][] = message-commons_activity_streams_user_profile_updated-field_target_users
features[message_type][] = commons_activity_streams_comment_created
features[message_type][] = commons_activity_streams_node_created
features[message_type][] = commons_activity_streams_user_profile_updated
features[variable][] = field_bundle_settings_message__commons_activity_streams_comment_created
features[variable][] = field_bundle_settings_message__commons_activity_streams_node_created
features[variable][] = field_bundle_settings_message__commons_activity_streams_user_profile_updated
features[variable][] = timeago_comment
features[variable][] = timeago_node
features[views_view][] = commons_activity_streams_activity
features[views_view][] = commons_activity_streams_user_activity
features_exclude[field][message-commons_activity_streams_comment_created-field_target_comments] = message-commons_activity_streams_comment_created-field_target_comments
features_exclude[field][message-commons_activity_streams_comment_created-field_target_nodes] = message-commons_activity_streams_comment_created-field_target_nodes
features_exclude[field][message-commons_activity_streams_node_created-field_target_nodes] = message-commons_activity_streams_node_created-field_target_nodes
features_exclude[field][message-commons_activity_streams_user_profile_updated-field_target_users] = message-commons_activity_streams_user_profile_updated-field_target_users
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

View File

@ -0,0 +1,65 @@
<?php
/**
* Update the "User follows user" message type.
*/
function commons_activity_streams_update_3101() {
features_revert(array('commons_activity_streams' => array('message_type', 'field_instance')));
return array();
}
/**
* Set activity stream user pictures to 35x35 image style.
*/
function commons_activity_streams_update_3102() {
$revert = array(
'commons_activity_streams' => array('message_type'),
);
features_revert($revert);
return array();
}
/**
* Reset field instances to hide the target users field from the updated profile message.
*/
function commons_activity_streams_update_3103() {
$revert = array(
'commons_activity_streams' => array('field_instance'),
);
features_revert($revert);
return array();
}
/**
* Enable timeago for nodes and comments.
*/
function commons_activity_streams_update_3104() {
$revert = array(
'commons_activity_streams' => array('variable'),
);
features_revert($revert);
return array();
}
/**
* Remove duplicative node access filters from Commons Activity Streams views.
*/
function commons_activity_streams_update_3105() {
$revert = array(
'commons_activity_streams' => array('views_view'),
'commons_activity_streams_groups' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Add empty text to Commons Activity Streams views.
*/
function commons_activity_streams_update_3106() {
$revert = array(
'commons_activity_streams' => array('views_view'),
);
features_revert($revert);
return array();
}

View File

@ -0,0 +1,265 @@
<?php
include_once 'commons_activity_streams.features.inc';
/**
* Implements hook_form_alter().
*/
function commons_activity_streams_form_alter(&$form, &$form_state, $form_id) {
// Customize the text on the filter for Activity landing page.
if ($form_id == 'views_exposed_form' && $form['#id'] == 'views-exposed-form-commons-activity-streams-activity-panel-pane-3') {
$form['following']['#options'][0] = t("activity I'm not following");
$form['following']['#options'][1] = t("activity I'm following");
}
if ($form_id == 'edit_profile_user_profile_form') {
// Store default values in form state storage for change detection.
static $profile_form_state;
if (!isset($profile_form_state)) {
// Use a copy of $form and $form_state for prepare and process.
$profile_form = array_merge(array(), $form);
$profile_form_state = array_merge(array(), $form_state);
drupal_prepare_form('edit_profile_user_profile_form', $profile_form, $profile_form_state);
drupal_process_form('edit_profile_user_profile_form', $profile_form, $profile_form_state);
$form_state['storage']['values'] = $profile_form_state['values'];
}
$form['#submit'][] = 'commons_activity_streams_user_profile_submit';
}
}
/**
* Implements hook_node_insert().
*/
function commons_activity_streams_node_insert($node) {
// Create a message when a user creates a new node.
$account = user_load($node->uid);
// Allow other modules to change the message type used for this event.
$hook = 'node_insert';
$message_type = 'commons_activity_streams_node_created';
drupal_alter('commons_activity_streams_message_selection', $message_type, $hook, $node);
$message = message_create($message_type, array('uid' => $account->uid, 'timestamp' => $node->created));
// Save reference to the node in the node reference field, and the
$wrapper = entity_metadata_wrapper('message', $message);
// We use a multiple value field in case we wish to use the same
// field for grouping messages in the future
// (eg http://drupal.org/node/1757060).
$wrapper->field_target_nodes[] = $node;
$wrapper->save();
}
/**
* Implements hook_comment_insert().
*/
function commons_activity_streams_comment_insert($comment) {
$account = user_load($comment->uid);
$node = node_load($comment->nid);
// Allow other modules to change the message type used for this event.
$hook = 'comment_insert';
$message_type = 'commons_activity_streams_comment_created';
drupal_alter('commons_activity_streams_message_selection', $message_type, $hook, $node);
$message = message_create($message_type, array('uid' => $account->uid, 'timestamp' => $comment->created));
// Save reference to the node in the node reference field, and the
// "publish" state (i.e. if the node is published or unpublished).
$wrapper = entity_metadata_wrapper('message', $message);
$wrapper->field_target_nodes[] = $node;
$wrapper->field_target_comments[] = $comment;
// The message should be published only if the node and the comment are
// both published.
// @todo: Deal with message publishing/unpublishing.
/*
$published = $node->status && $comment->status;
$wrapper->field_published->set($published);
*/
$wrapper->save();
}
/**
* Implements hook_comment_delete().
*/
function commons_activity_streams_comment_delete($comment) {
// Delete the activity stream message created when this comment
// was posted.
if ($mids = commons_activity_streams_existing_messages($comment->uid, array($comment->cid), 'field_target_comments', 'commons_activity_streams_comment_created')) {
message_delete_multiple($mids);
}
}
/**
* Implements hook_message_access_alter().
*/
function commons_activity_streams_message_access_alter(&$access, $context) {
// We're only interested in the 'view' operation.
if ($context['op'] != 'view') {
return;
}
$message = $context['entity'];
// Verify view access to nodes referenced in the message.
if (isset($message->field_target_nodes)) {
foreach ($message->field_target_nodes[LANGUAGE_NONE] as $key => $value) {
$node = node_load($value['target_id']);
if (!node_access('view', $node, $context['account'])) {
// If the user cannot view any nodes in the message,
// deny access to the entire message;
$access = FALSE;
return;
}
}
}
}
/**
* Find existing messages that match certain parameters.
*/
function commons_activity_streams_existing_messages($acting_uid, $target_ids, $target_field, $message_type) {
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'message', '=')
->propertyCondition('uid', $acting_uid)
->propertyCondition('type', $message_type, '=')
->fieldCondition($target_field, 'target_id', $target_ids, 'IN')
->execute();
if (!empty($query->ordered_results)) {
$mids = array();
foreach($query->ordered_results as $result) {
$mids[] = $result->entity_id;
}
return $mids;
}
return FALSE;
}
/**
* Create an activity stream message when a user updates her profile.
*/
function commons_activity_streams_user_profile_submit($form, &$form_state) {
global $user;
// Fields to ignore in $form_state['values'] when detecting changes.
$remove_keys = array(
'uid',
'name',
'pass',
'current_pass_required_values',
'current_pass',
'status',
'roles',
'notify',
'signature',
'picture_delete',
'message_subscribe_email',
'og_user_node',
'cancel',
'metatags',
'timezone',
'signature_format',
'form_token',
'form_id',
'form_build_id',
'picture_upload',
'submit'
);
$profile_values = array_diff_key($form_state['values'], array_flip($remove_keys));
ksort($profile_values);
$profile_data = serialize($profile_values);
$stored_profile_values = array_diff_key($form_state['storage']['values'], array_flip($remove_keys));
ksort($stored_profile_values);
$stored_profile_data = serialize($stored_profile_values);
// Do not generate a message if
// - the user did not submit their own form
// - no changes were detected
// - a profile update message created within the last 15 minutes
$time_ago = time() - 900;
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'message')
->propertyCondition('uid', $form_state['user']->uid)
->propertyCondition('type', 'commons_activity_streams_user_profile_updated')
->propertyCondition('timestamp', $time_ago, '>')
->count();
$count = $query->execute();
if ($user->uid != $form_state['user']->uid ||
$profile_data == $stored_profile_data ||
$count > 0) {
return;
}
$account = $form_state['user'];
// Allow other modules to change the message type used for this event.
$hook = 'user_profile_update';
$message_type = 'commons_activity_streams_user_profile_updated';
drupal_alter('commons_activity_streams_message_selection', $message_type, $hook, $account);
$message = message_create($message_type, array('uid' => $account->uid, 'timestamp' => REQUEST_TIME));
// Save reference to the node in the node reference field, and the
$wrapper = entity_metadata_wrapper('message', $message);
$wrapper->field_target_users[] = $account;
$wrapper->save();
}
/**
* Implements hook_token_info().
*/
function commons_activity_streams_token_info() {
$styles = image_styles();
$tokens = array();
foreach ($styles as $style_name => $style) {
$tokens['picture:' . $style_name] = array(
'name' => t('Picture: @st image style', array('@st' => $style_name)),
'description' => t('Picture: @st image style', array('@st' => $style_name)),
);
}
return array(
'tokens' => array(
'user' => $tokens,
),
);
}
/**
* Implements hook_tokens().
*/
function commons_activity_streams_tokens($type, $tokens, array $data = array(), array $options = array()) {
$replacements = array();
if ($type == 'user' && isset($data['user'])) {
$user = $data['user'];
$user_wrapper = entity_metadata_wrapper('user', $user);
$alt = $user->name;
if (isset($user->field_name_first)) {
$alt = $user_wrapper->field_name_first->value();
if (isset($user->field_name_last)) {
$alt .= " " . $user_wrapper->field_name_last->value();
}
}
$alt = t("@name's picture", array('@name' => $alt));
foreach ($tokens as $token => $original) {
if (strpos($token, 'picture:') !== FALSE) {
list( , $style) = explode(':', $token);
$path = variable_get('user_picture_default', '/profiles/commons/images/avatars/user-avatar.png');
if (!empty($user->picture)) {
$path = image_style_url($style, $user->picture->uri);
}
$image_variables = array(
'path' => $path,
'alt' => $alt,
'title' => $alt,
'class' => array('image-style-none'),
);
$image = theme('image', $image_variables);
$user_path = user_uri($user);
$link_options = array(
'attributes' => array(
'title' => t('View user profile.'),
),
'html' => TRUE,
);
$replacements[$original] = "<div class='user-picture'>" . l($image, $user_path['path'], $link_options) . "</div>";
}
}
}
return $replacements;
}

View File

@ -0,0 +1,130 @@
<?php
/**
* @file
* commons_activity_streams.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function commons_activity_streams_strongarm() {
$export = array();
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'field_bundle_settings_message__commons_activity_streams_comment_created';
$strongarm->value = array(
'view_modes' => array(),
'extra_fields' => array(
'form' => array(),
'display' => array(
'message__message_text__0' => array(
'message_notify_email_subject' => array(
'visible' => TRUE,
'weight' => 0,
),
'message_notify_email_body' => array(
'visible' => FALSE,
'weight' => 0,
),
),
'message__message_text__1' => array(
'message_notify_email_subject' => array(
'visible' => FALSE,
'weight' => 0,
),
'message_notify_email_body' => array(
'visible' => TRUE,
'weight' => 0,
),
),
),
),
);
$export['field_bundle_settings_message__commons_activity_streams_comment_created'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'field_bundle_settings_message__commons_activity_streams_node_created';
$strongarm->value = array(
'view_modes' => array(),
'extra_fields' => array(
'form' => array(),
'display' => array(
'message__message_text__0' => array(
'message_notify_email_subject' => array(
'visible' => TRUE,
'weight' => 0,
),
'message_notify_email_body' => array(
'visible' => FALSE,
'weight' => 0,
),
),
'message__message_text__1' => array(
'message_notify_email_subject' => array(
'visible' => FALSE,
'weight' => 0,
),
'message_notify_email_body' => array(
'visible' => TRUE,
'weight' => 0,
),
),
),
),
);
$export['field_bundle_settings_message__commons_activity_streams_node_created'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'field_bundle_settings_message__commons_activity_streams_user_profile_updated';
$strongarm->value = array(
'view_modes' => array(),
'extra_fields' => array(
'form' => array(),
'display' => array(
'message__message_text__0' => array(
'message_notify_email_subject' => array(
'visible' => TRUE,
'weight' => 0,
),
'message_notify_email_body' => array(
'visible' => FALSE,
'weight' => 0,
),
),
'message__message_text__1' => array(
'message_notify_email_subject' => array(
'visible' => FALSE,
'weight' => 0,
),
'message_notify_email_body' => array(
'visible' => TRUE,
'weight' => 0,
),
),
),
),
);
$export['field_bundle_settings_message__commons_activity_streams_user_profile_updated'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'timeago_comment';
$strongarm->value = 1;
$export['timeago_comment'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'timeago_node';
$strongarm->value = 1;
$export['timeago_node'] = $strongarm;
return $export;
}

View File

@ -0,0 +1,320 @@
<?php
/**
* @file
* commons_activity_streams.views_default.inc
*/
/**
* Implements hook_views_default_views().
*/
function commons_activity_streams_views_default_views() {
$export = array();
$view = new view();
$view->name = 'commons_activity_streams_activity';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'message';
$view->human_name = 'Commons Activity Streams - Activity (Site-wide)';
$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'] = 'Recent site activity';
$handler->display->display_options['use_ajax'] = TRUE;
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['link_display'] = 'custom_url';
$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'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '20';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* 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';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = 'Nobody has performed any activity on the site recently.';
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
/* Relationship: Entity Reference: Referenced Entity */
$handler->display->display_options['relationships']['field_target_nodes_target_id']['id'] = 'field_target_nodes_target_id';
$handler->display->display_options['relationships']['field_target_nodes_target_id']['table'] = 'field_data_field_target_nodes';
$handler->display->display_options['relationships']['field_target_nodes_target_id']['field'] = 'field_target_nodes_target_id';
/* Field: Message: Rendered Message */
$handler->display->display_options['fields']['rendered_entity']['id'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['table'] = 'views_entity_message';
$handler->display->display_options['fields']['rendered_entity']['field'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['label'] = '';
$handler->display->display_options['fields']['rendered_entity']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['rendered_entity']['link_to_entity'] = 1;
$handler->display->display_options['fields']['rendered_entity']['display'] = 'view';
$handler->display->display_options['fields']['rendered_entity']['view_mode'] = 'full';
/* Field: Message: Timestamp */
$handler->display->display_options['fields']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['table'] = 'message';
$handler->display->display_options['fields']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['label'] = '';
$handler->display->display_options['fields']['timestamp']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['timestamp']['date_format'] = 'time_ago_dynamic';
/* Sort criterion: Message: Timestamp */
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['table'] = 'message';
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
/* Contextual filter: Message: Message ID */
$handler->display->display_options['arguments']['mid']['id'] = 'mid';
$handler->display->display_options['arguments']['mid']['table'] = 'message';
$handler->display->display_options['arguments']['mid']['field'] = 'mid';
$handler->display->display_options['arguments']['mid']['default_action'] = 'default';
$handler->display->display_options['arguments']['mid']['default_argument_type'] = 'commons_follow_message';
$handler->display->display_options['arguments']['mid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['mid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['mid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['mid']['break_phrase'] = TRUE;
/* Filter criterion: Content: Published or admin */
$handler->display->display_options['filters']['status_extra']['id'] = 'status_extra';
$handler->display->display_options['filters']['status_extra']['table'] = 'node';
$handler->display->display_options['filters']['status_extra']['field'] = 'status_extra';
$handler->display->display_options['filters']['status_extra']['relationship'] = 'field_target_nodes_target_id';
/* Filter criterion: Message: User Follow */
$handler->display->display_options['filters']['cf_user_follow_message']['id'] = 'cf_user_follow_message';
$handler->display->display_options['filters']['cf_user_follow_message']['table'] = 'message';
$handler->display->display_options['filters']['cf_user_follow_message']['field'] = 'cf_user_follow_message';
$handler->display->display_options['filters']['cf_user_follow_message']['value'] = '0';
$handler->display->display_options['filters']['cf_user_follow_message']['exposed'] = TRUE;
$handler->display->display_options['filters']['cf_user_follow_message']['expose']['operator_id'] = '';
$handler->display->display_options['filters']['cf_user_follow_message']['expose']['label'] = 'Show';
$handler->display->display_options['filters']['cf_user_follow_message']['expose']['operator'] = 'cf_user_follow_message_op';
$handler->display->display_options['filters']['cf_user_follow_message']['expose']['identifier'] = 'following';
$handler->display->display_options['filters']['cf_user_follow_message']['expose']['required'] = TRUE;
$handler->display->display_options['filters']['cf_user_follow_message']['expose']['remember'] = TRUE;
$handler->display->display_options['filters']['cf_user_follow_message']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
);
/* Filter criterion: Message: Message category */
$handler->display->display_options['filters']['type_category']['id'] = 'type_category';
$handler->display->display_options['filters']['type_category']['table'] = 'message';
$handler->display->display_options['filters']['type_category']['field'] = 'type_category';
$handler->display->display_options['filters']['type_category']['value'] = array(
'message_type' => 'message_type',
);
/* Display: Activity (Sidebar) */
$handler = $view->new_display('panel_pane', 'Activity (Sidebar)', 'panel_pane_1');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['use_more'] = FALSE;
$handler->display->display_options['use_more'] = TRUE;
$handler->display->display_options['defaults']['use_more_always'] = FALSE;
$handler->display->display_options['defaults']['use_more_always'] = FALSE;
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['defaults']['use_more_text'] = FALSE;
$handler->display->display_options['link_url'] = 'activity';
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['defaults']['relationships'] = FALSE;
/* Relationship: Entity Reference: Referenced Entity */
$handler->display->display_options['relationships']['field_target_nodes_target_id']['id'] = 'field_target_nodes_target_id';
$handler->display->display_options['relationships']['field_target_nodes_target_id']['table'] = 'field_data_field_target_nodes';
$handler->display->display_options['relationships']['field_target_nodes_target_id']['field'] = 'field_target_nodes_target_id';
$handler->display->display_options['defaults']['arguments'] = FALSE;
$handler->display->display_options['defaults']['filter_groups'] = FALSE;
$handler->display->display_options['defaults']['filters'] = FALSE;
/* Filter criterion: Message: Message category */
$handler->display->display_options['filters']['type_category']['id'] = 'type_category';
$handler->display->display_options['filters']['type_category']['table'] = 'message';
$handler->display->display_options['filters']['type_category']['field'] = 'type_category';
$handler->display->display_options['filters']['type_category']['value'] = array(
'message_type' => 'message_type',
);
/* Filter criterion: Content: Published or admin */
$handler->display->display_options['filters']['status_extra']['id'] = 'status_extra';
$handler->display->display_options['filters']['status_extra']['table'] = 'node';
$handler->display->display_options['filters']['status_extra']['field'] = 'status_extra';
$handler->display->display_options['filters']['status_extra']['relationship'] = 'field_target_nodes_target_id';
/* Display: Activity - Full view */
$handler = $view->new_display('panel_pane', 'Activity - Full view', 'panel_pane_3');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['pane_category']['name'] = 'Commons';
$handler->display->display_options['pane_category']['weight'] = '0';
$handler->display->display_options['inherit_panels_path'] = '1';
$translatables['commons_activity_streams_activity'] = array(
t('Master'),
t('Recent site activity'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Items per page'),
t('- All -'),
t('Offset'),
t('« first'),
t(' previous'),
t('next '),
t('last »'),
t('Nobody has performed any activity on the site recently.'),
t('Content entity referenced from field_target_nodes'),
t('All'),
t('Show'),
t('Activity (Sidebar)'),
t('Commons'),
t('Activity - Full view'),
);
$export['commons_activity_streams_activity'] = $view;
$view = new view();
$view->name = 'commons_activity_streams_user_activity';
$view->description = '';
$view->tag = 'commons';
$view->base_table = 'message';
$view->human_name = 'Commons Activity Streams (User-specific activity)';
$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'] = 'Recent site activity';
$handler->display->display_options['use_ajax'] = TRUE;
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['link_display'] = 'custom_url';
$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'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '20';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* 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';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = 'This person hasn\'t performed any activities on the site yet.';
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
/* Relationship: Entity Reference: Referenced Entity */
$handler->display->display_options['relationships']['field_target_nodes_target_id']['id'] = 'field_target_nodes_target_id';
$handler->display->display_options['relationships']['field_target_nodes_target_id']['table'] = 'field_data_field_target_nodes';
$handler->display->display_options['relationships']['field_target_nodes_target_id']['field'] = 'field_target_nodes_target_id';
/* Field: Message: Rendered Message */
$handler->display->display_options['fields']['rendered_entity']['id'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['table'] = 'views_entity_message';
$handler->display->display_options['fields']['rendered_entity']['field'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['label'] = '';
$handler->display->display_options['fields']['rendered_entity']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['rendered_entity']['link_to_entity'] = 1;
$handler->display->display_options['fields']['rendered_entity']['display'] = 'view';
$handler->display->display_options['fields']['rendered_entity']['view_mode'] = 'full';
/* Field: Message: Timestamp */
$handler->display->display_options['fields']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['table'] = 'message';
$handler->display->display_options['fields']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['label'] = '';
$handler->display->display_options['fields']['timestamp']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['timestamp']['date_format'] = 'time_ago_dynamic';
/* Sort criterion: Message: Timestamp */
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['table'] = 'message';
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
/* Contextual filter: Message: User uid */
$handler->display->display_options['arguments']['user']['id'] = 'user';
$handler->display->display_options['arguments']['user']['table'] = 'message';
$handler->display->display_options['arguments']['user']['field'] = 'user';
$handler->display->display_options['arguments']['user']['default_action'] = 'not found';
$handler->display->display_options['arguments']['user']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['user']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['user']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['user']['summary_options']['items_per_page'] = '25';
/* Filter criterion: Content: Published or admin */
$handler->display->display_options['filters']['status_extra']['id'] = 'status_extra';
$handler->display->display_options['filters']['status_extra']['table'] = 'node';
$handler->display->display_options['filters']['status_extra']['field'] = 'status_extra';
$handler->display->display_options['filters']['status_extra']['relationship'] = 'field_target_nodes_target_id';
/* Filter criterion: Message: Message category */
$handler->display->display_options['filters']['type_category']['id'] = 'type_category';
$handler->display->display_options['filters']['type_category']['table'] = 'message';
$handler->display->display_options['filters']['type_category']['field'] = 'type_category';
$handler->display->display_options['filters']['type_category']['value'] = array(
'message_type' => 'message_type',
);
/* Display: Activity (Sidebar) */
$handler = $view->new_display('panel_pane', 'Activity (Sidebar)', 'panel_pane_1');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['use_more'] = FALSE;
$handler->display->display_options['use_more'] = TRUE;
$handler->display->display_options['defaults']['use_more_always'] = FALSE;
$handler->display->display_options['defaults']['use_more_always'] = FALSE;
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['defaults']['use_more_text'] = FALSE;
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'load_more';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['pane_category']['name'] = 'Commons';
$handler->display->display_options['pane_category']['weight'] = '0';
$handler->display->display_options['argument_input'] = array(
'user' => array(
'type' => 'context',
'context' => 'entity:user.uid',
'context_optional' => 0,
'panel' => '0',
'fixed' => '',
'label' => 'Message: User uid',
),
);
/* Display: Activity - Full view */
$handler = $view->new_display('panel_pane', 'Activity - Full view', 'panel_pane_3');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['pane_category']['name'] = 'Commons';
$handler->display->display_options['pane_category']['weight'] = '0';
$translatables['commons_activity_streams_user_activity'] = array(
t('Master'),
t('Recent site activity'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Items per page'),
t('- All -'),
t('Offset'),
t('« first'),
t(' previous'),
t('next '),
t('last »'),
t('This person hasn\'t performed any activities on the site yet.'),
t('Content entity referenced from field_target_nodes'),
t('All'),
t('Activity (Sidebar)'),
t('Commons'),
t('Activity - Full view'),
);
$export['commons_activity_streams_user_activity'] = $view;
return $export;
}

View File

@ -0,0 +1,12 @@
<?php
/**
* @file
* commons_activity_streams_groups.features.inc
*/
/**
* Implements hook_views_api().
*/
function commons_activity_streams_groups_views_api($module = NULL, $api = NULL) {
return array("api" => "3.0");
}

View File

@ -0,0 +1,11 @@
name = Commons Activity Streams Groups
description = Contains Organic Groups integration for Commons Activity Streams
core = 7.x
package = Commons - Building blocks
dependencies[] = commons_activity_streams
dependencies[] = entity
dependencies[] = views
dependencies[] = views_content
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[views_view][] = activity_group

View File

@ -0,0 +1,12 @@
<?php
/**
* Add empty text to Commons Activity Streams Groups views.
*/
function commons_activity_streams_groups_update_3101() {
$revert = array(
'commons_activity_streams_groups' => array('views_view'),
);
features_revert($revert);
return array();
}

View File

@ -0,0 +1,7 @@
<?php
/**
* @file
* Code for the Commons Activity Streams Groups feature.
*/
include_once 'commons_activity_streams_groups.features.inc';

View File

@ -0,0 +1,149 @@
<?php
/**
* @file
* commons_activity_streams_groups.views_default.inc
*/
/**
* Implements hook_views_default_views().
*/
function commons_activity_streams_groups_views_default_views() {
$export = array();
$view = new view();
$view->name = 'activity_group';
$view->description = '';
$view->tag = 'Commons';
$view->base_table = 'message';
$view->human_name = 'Commons Activity Streams - Group activity';
$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'] = 'Recent activity in this group';
$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'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '4';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* 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';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = 'Nobody has performed any activity in this group recently.';
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
/* Relationship: Entity Reference: Referenced Entity */
$handler->display->display_options['relationships']['field_target_nodes_target_id']['id'] = 'field_target_nodes_target_id';
$handler->display->display_options['relationships']['field_target_nodes_target_id']['table'] = 'field_data_field_target_nodes';
$handler->display->display_options['relationships']['field_target_nodes_target_id']['field'] = 'field_target_nodes_target_id';
$handler->display->display_options['relationships']['field_target_nodes_target_id']['required'] = TRUE;
/* Relationship: OG membership: OG membership from Node */
$handler->display->display_options['relationships']['og_membership_rel']['id'] = 'og_membership_rel';
$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']['relationship'] = 'field_target_nodes_target_id';
$handler->display->display_options['relationships']['og_membership_rel']['required'] = TRUE;
/* Field: Message: Rendered Message */
$handler->display->display_options['fields']['rendered_entity']['id'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['table'] = 'views_entity_message';
$handler->display->display_options['fields']['rendered_entity']['field'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['label'] = '';
$handler->display->display_options['fields']['rendered_entity']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['rendered_entity']['link_to_entity'] = 0;
$handler->display->display_options['fields']['rendered_entity']['display'] = 'view';
$handler->display->display_options['fields']['rendered_entity']['view_mode'] = 'full';
/* Field: Message: Timestamp */
$handler->display->display_options['fields']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['table'] = 'message';
$handler->display->display_options['fields']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['fields']['timestamp']['label'] = '';
$handler->display->display_options['fields']['timestamp']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['timestamp']['date_format'] = 'time_ago_dynamic';
/* Sort criterion: Message: Timestamp */
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['table'] = 'message';
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
/* Contextual filter: OG membership: Group ID */
$handler->display->display_options['arguments']['gid']['id'] = 'gid';
$handler->display->display_options['arguments']['gid']['table'] = 'og_membership';
$handler->display->display_options['arguments']['gid']['field'] = 'gid';
$handler->display->display_options['arguments']['gid']['relationship'] = 'og_membership_rel';
$handler->display->display_options['arguments']['gid']['default_action'] = 'not found';
$handler->display->display_options['arguments']['gid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['gid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['gid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['gid']['summary_options']['items_per_page'] = '25';
/* Filter criterion: Content: Published or admin */
$handler->display->display_options['filters']['status_extra']['id'] = 'status_extra';
$handler->display->display_options['filters']['status_extra']['table'] = 'node';
$handler->display->display_options['filters']['status_extra']['field'] = 'status_extra';
$handler->display->display_options['filters']['status_extra']['relationship'] = 'field_target_nodes_target_id';
/* Filter criterion: Message: Message category */
$handler->display->display_options['filters']['type_category']['id'] = 'type_category';
$handler->display->display_options['filters']['type_category']['table'] = 'message';
$handler->display->display_options['filters']['type_category']['field'] = 'type_category';
$handler->display->display_options['filters']['type_category']['value'] = array(
'message_type' => 'message_type',
);
/* 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';
$handler->display->display_options['filters']['group_type']['field'] = 'group_type';
$handler->display->display_options['filters']['group_type']['relationship'] = 'og_membership_rel';
$handler->display->display_options['filters']['group_type']['value'] = array(
'node' => 'node',
);
/* Display: Content pane */
$handler = $view->new_display('panel_pane', 'Content pane', 'panel_pane_1');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['pane_category']['name'] = 'Commons';
$handler->display->display_options['pane_category']['weight'] = '0';
$handler->display->display_options['allow']['use_pager'] = 0;
$handler->display->display_options['allow']['items_per_page'] = 'items_per_page';
$handler->display->display_options['allow']['offset'] = 0;
$handler->display->display_options['allow']['link_to_view'] = 0;
$handler->display->display_options['allow']['more_link'] = 0;
$handler->display->display_options['allow']['path_override'] = 0;
$handler->display->display_options['allow']['title_override'] = 0;
$handler->display->display_options['allow']['exposed_form'] = 0;
$handler->display->display_options['allow']['fields_override'] = 0;
$handler->display->display_options['argument_input'] = array(
'gid' => array(
'type' => 'user',
'context' => 'entity:comment.author',
'context_optional' => 0,
'panel' => '0',
'fixed' => '',
'label' => 'OG membership: Group ID',
),
);
$translatables['activity_group'] = array(
t('Master'),
t('Recent activity in this group'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Nobody has performed any activity in this group recently.'),
t('Content entity referenced from field_target_nodes'),
t('OG membership from node'),
t('All'),
t('Content pane'),
t('Commons'),
);
$export['activity_group'] = $view;
return $export;
}

View File

@ -0,0 +1,43 @@
<?php
/**
* @file
* commons_body.features.field_base.inc
*/
/**
* Implements hook_field_default_field_bases().
*/
function commons_body_field_default_field_bases() {
$field_bases = array();
// Exported field_base: 'body'
$field_bases['body'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(
0 => 'node',
),
'field_name' => 'body',
'foreign keys' => array(
'format' => array(
'columns' => array(
'format' => 'format',
),
'table' => 'filter_format',
),
),
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => 0,
'module' => 'text',
'settings' => array(),
'translatable' => 0,
'type' => 'text_with_summary',
);
return $field_bases;
}

View File

@ -0,0 +1,9 @@
name = Commons Body Field
description = Provides a simple body field for re-use by various Commons content types
core = 7.x
package = Commons - Building blocks
dependencies[] = features
dependencies[] = field_sql_storage
dependencies[] = text
features[features_api][] = api:2
features[field_base][] = body

View File

@ -0,0 +1,5 @@
<?php
/**
* @file
* Drupal needs this blank file.
*/

4
modules/commons/commons_bw/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/plugins/quicktabs_styles/commons_origins/.sass-cache/
/plugins/quicktabs_styles/commons_origins_tabs/.sass-cache/
/plugins/quicktabs_styles/commons_pills/.sass-cache/
/plugins/quicktabs_styles/commons_tabs/.sass-cache/

View File

@ -0,0 +1,43 @@
<?php
/**
* @file
* commons_bw.features.field_base.inc
*/
/**
* Implements hook_field_default_field_bases().
*/
function commons_bw_field_default_field_bases() {
$field_bases = array();
// Exported field_base: 'title_field'
$field_bases['title_field'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'title_field',
'foreign keys' => array(
'format' => array(
'columns' => array(
'format' => 'format',
),
'table' => 'filter_format',
),
),
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => 0,
'module' => 'text',
'settings' => array(
'max_length' => 255,
),
'translatable' => 1,
'type' => 'text',
);
return $field_bases;
}

View File

@ -0,0 +1,73 @@
<?php
/**
* @file
* commons_bw.features.field_instance.inc
*/
/**
* Implements hook_field_default_field_instances().
*/
function commons_bw_field_default_field_instances() {
$field_instances = array();
foreach (node_type_get_types() as $node_type) {
if (commons_bw_node_auto_title_instance($node_type->type)) {
commons_bw_field_definition($field_instances, $node_type->type);
}
}
// Translatables
// Included for use with string extractors like potx.
t('Title');
return $field_instances;
}
/**
* Creates field instance definitions for all node types.
*/
function commons_bw_field_definition(&$field_instances, $bundle) {
// Exported field_instance: 'node-[Bundle]-title_field'
$field_instances["node-$bundle-title_field"] = array(
'bundle' => $bundle,
'default_value' => NULL,
'deleted' => '0',
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 12,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'display_in_partial_form' => !empty($display_in_partial_form[$bundle]),
'entity_type' => 'node',
'field_name' => 'title_field',
'label' => 'Title',
'required' => 1,
'settings' => array(
'hide_label' => array(
'entity' => 0,
'page' => 0,
),
'text_processing' => '0',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'size' => '60',
),
'type' => 'text_textfield',
'weight' => -5,
),
);
}

View File

@ -0,0 +1,13 @@
name = Commons Tabbed Browsing Widget
core = 7.x
package = Commons - Building blocks
dependencies[] = commons_groups
dependencies[] = features
dependencies[] = og
dependencies[] = quicktabs
dependencies[] = quicktabs_tabstyles
dependencies[] = title
features[features_api][] = api:2
features[field_base][] = title_field
files[] = includes/views/handlers/commons_bw_handler_node_partial_form.inc
; Views handlers

View File

@ -0,0 +1,34 @@
<?php
/**
* Add the Title field to all browsing widget-enabled content types.
* per http://drupal.org/node/1969088.
*/
function commons_bw_update_7301() {
module_enable(array('title'));
$revert = array(
'commons_bw' => array(
'field_base', 'field_instance',
),
);
features_revert($revert);
return array();
}
/**
* Make sure existing nodes titles are migrated to the title field.
* per http://drupal.org/node/1969088.
*/
function commons_bw_update_7302() {
foreach (node_type_get_types() as $node_type) {
// Set the title as "Replaced by title_field".
if (!title_field_replacement_enabled('node', $node_type->type, 'title')) {
title_field_replacement_toggle('node', $node_type->type, 'title');
}
// Migrate the titles to the title field.
title_field_replacement_batch_set('node', $node_type->type, 'title');
}
drupal_flush_all_caches();
}

View File

@ -0,0 +1,402 @@
<?php
/**
* Implements hook_system_info_alter().
*/
function commons_bw_system_info_alter(&$info, $file, $type) {
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";
}
}
}
}
/**
* 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().
*
* The bundle is added to the partial node form ID, to prevent duplicate IDs on
* the same page, but all of the partial forms are built with the same function.
*/
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',
);
}
return $forms;
}
/**
* Partial node form for the browsing widget.
*
* @param $bundle
* The node bundle.
*/
function commons_bw_partial_node_form($form, &$form_state, $bundle, $group_id = NULL) {
global $user;
global $language;
if (!$group_id) {
// Reset the og_field_widget_form cache because otherwise it ignores
// multiple tries to render the same group audience widget (We have the
// same group audience widget on the All and Posts tabs, when displaying
// this form without group context).
drupal_static_reset('og_field_widget_form');
}
if ($group_id) {
$form_state['group_id'] = $group_id;
}
$instances = field_info_instances('node', $bundle);
// Remove all fields except those marked as "display_in_partial_form".
foreach($instances as $field_name => $instance) {
if (empty($instance['display_in_partial_form'])) {
unset($instances[$field_name]);
}
}
// Make sure there's a field left to display.
if (empty($instances)) {
return $form;
}
// Create a dummy node for field_attach_form().
$node = new stdClass();
$node->type = $bundle;
node_object_prepare($node);
if (module_exists('locale')) {
if (locale_multilingual_node_type($node->type)) {
$node->language = $language->language;
}
else {
$default = language_default();
$node->language = $default->language;
}
}
else {
$node->language = LANGUAGE_NONE;
}
field_attach_form('node', $node, $form, $form_state, entity_language('node', $node));
foreach(element_children($form) as $field_name) {
if (empty($instances[$field_name])) {
$form[$field_name]['#access'] = FALSE;
}
}
if (!empty($form['#metatags'])) {
unset($form['#metatags']);
}
// When not in a group context, enable the group audience widget.
$form[OG_AUDIENCE_FIELD]['#weight'] = 100;
$form[OG_AUDIENCE_FIELD]['#access'] = !$group_id;
// Form title.
$bundles = field_info_bundles('node');
$form['title'] = array(
'#markup' => '<h3>' . t('Create a @bundle', array('@bundle' => strtolower($bundles[$bundle]['label']))) . '</h3>',
'#weight' => -50,
);
// Display the user's picture.
$wrapper = entity_metadata_wrapper('user', $user);
$path = empty($user->picture) ? variable_get('user_picture_default') : $wrapper->value()->picture->uri;
$form['user_picture'] = array(
'#theme' => 'image_style',
'#style_name' => '50x50_avatar',
'#path' => $path,
'#prefix' => '<div class="user-picture">',
'#suffix' => '</div>',
'#weight' => -20,
);
$form['actions'] = array(
'#type' => 'actions',
'#weight' => 200,
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
// Add in some descriptive classes for css down the line.
$form['#attributes']['class'][] = 'node';
$form['#attributes']['class'][] = 'commons-bw-partial-node-form';
$form['#attributes']['class'][] = 'commons-bw-partial-node-form-' . $bundle;
// Add a link to the full node form.
$form['full_form'] = array(
'#theme' => 'link',
'#text' => t('Go to full form'),
'#path' => 'node/add/' . str_replace('_', '-', $bundle),
'#options' => array(
'attributes' => array('class' => array('full-form')),
'html' => FALSE,
),
'#weight' => 100,
);
if ($group_id) {
$form['full_form']['#options']['query'] = array(OG_AUDIENCE_FIELD => $group_id);
}
// Add the commons_bw after build first, in case other pre-renders needs need
// 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;
}
/**
* After-build call-back. See commons_bw_partial_node_form().
*/
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);
foreach(element_children($form) as $field_name) {
if (!empty($form[$field_name]['#language'])) {
$language = $form[$field_name]['#language'];
if (!empty($form[$field_name][$language][0]['value']['#id'])) {
$form[$field_name][$language][0]['value']['#id'] .= $id_suffix;
}
if (!empty($form[$field_name][$language][0]['default']['#id'])) {
$form[$field_name][$language][0]['default']['#id'] .= $id_suffix;
}
}
}
// 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;
}
/**
* Validation handler; Attach the node validation to the partial node 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;
}
}
/**
* Submit handler; Create a node from the partial node form.
*/
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);
$wrapper = entity_metadata_wrapper('node', $node);
// If the node has a body and doesn't has a title, create a title from the
// body.
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);
}
}
// Set the group audience.
if (!empty($form_state['group_id'])) {
$wrapper->{OG_AUDIENCE_FIELD}->set(array($form_state['group_id']));
}
$node->form_state = $form_state;
$wrapper->save();
// 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().
*
* 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) {
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.
*/
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;
}
/**
* Provides a styled content creation dropdown widget for the 'all'
* tab of the group homepage browsing widget.
*/
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.
*/
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));
$settings = array('style' => 'Commons Pills', 'ajax' => FALSE, 'html' => TRUE);
// Load the default 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']);
}
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>';
}
// Set the default tab.
if (isset($tabs[$key]['default']) && $tabs[$key]['default']) {
$settings['default_tab'] = $key;
}
}
// Generate the Quicktabs instance.
return quicktabs_build_quicktabs('commons_bw', $settings, $tabs);
}
/**
* Implements hook_quicktabs_tabstyles().
*/
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'),
);
}

View File

@ -0,0 +1,18 @@
<?php
/**
* Implements hook_views_data()
*/
function commons_bw_views_data() {
$data = array();
$data['views']['commons_bw_node_partial_form'] = array(
'title' => t('Node partial form'),
'help' => t('Display a minified node creation form.'),
'area' => array(
'handler' => 'commons_bw_handler_node_partial_form',
),
);
return $data;
}

View File

@ -0,0 +1,52 @@
<?php
/**
* Minified node creation form.
*/
class commons_bw_handler_node_partial_form extends views_handler_area {
function option_definition() {
$options = parent::option_definition();
$options['bundle'] = array('default' => NULL);
return $options;
}
function options_form(&$form, &$form_state) {
$bundles = og_get_all_group_content_bundle();
$form['bundle'] = array(
'#type' => 'select',
'#title' => t('Node type'),
'#options' => !empty($bundles['node']) ? $bundles['node'] : array(),
'#default_value' => $this->options['bundle'],
'#required' => TRUE,
);
}
function render($empty = FALSE) {
$cache = &drupal_static(__METHOD__, array());
$bundle = $this->options['bundle'];
$group_id = !empty($this->view->args[0]) ? $this->view->args[0] : NULL;
// Verify content creation access.
$permission = "create $bundle content";
if ($group_id && !og_user_access('node', $group_id, $permission)) {
return;
}
elseif (!user_access($permission)) {
return;
}
// Avoid rendering a form for the same bundle twice; Instead, mark that it
// should be moved to this position from previously rendered form.
// See partial_node_form.js.
if (!empty($cache[$bundle])) {
return '<div class="partial-node-form-placeholder" data-bundle="' . $bundle . '"></div>';
}
$cache[$bundle] = TRUE;
$form = drupal_get_form("commons_bw_partial_node_form__$bundle", $bundle, $group_id);
return render($form);
}
}

View File

@ -0,0 +1,82 @@
(function ($) {
/**
* Handles presentation of multiple partial forms of the same node bundle; When
* showing a tab, check if it has a form's placeholder and if so, move the form
* to the current tab and move the placeholder to the former form's tab.
*/
Drupal.behaviors.commonsBwPartialNodeForm = {
attach: function (context, settings) {
$('.quicktabs-tabs a', context).click(function(){
var $activeTab = $('#quicktabs-container-commons_bw .quicktabs-tabpage:not(.quicktabs-hide)', context);
// Check for a form placeholder.
var $placeholder = $activeTab.find('.partial-node-form-placeholder');
if (!$placeholder.length) {
return;
}
var $form = $('.commons-bw-partial-node-form-' + $placeholder.data('bundle'), context);
var $originalParent = $form.parent();
// Replace the placeholder and the form.
$form.appendTo($placeholder.parent());
$placeholder.appendTo($originalParent);
});
}
}
/**
* Expand a form when it is focused.
*/
Drupal.behaviors.commonsBwExpandableForm = {
attach: function (context, settings) {
$('.commons-bw-partial-node-form', context).once('commonsBwExpandableForm', function () {
// Assemble the variables.
var form = $(this),
toggleText = Drupal.t('Collapse the form'),
toggle = $('<a/>').attr({
'class': 'expandable-form-toggle element-hidden',
'href': '#',
'title': toggleText
}).append(toggleText),
triggerField = form.find('.trigger-field'),
fullFormLink = form.find('a.full-form'),
hideables = form.find('.hideable-field'),
errors = form.find('.error');
// Determine if the form has any errors.
if (!errors.length) {
// Forms with errors are shown expanded, so only add the toggle link to
// the top of forms which are error free.
form.prepend(toggle).addClass('expandable-form compact-form');
// Hide the hidden fields on load.
hideables.addClass('element-invisible');
}
else {
// The full form link is only shown on collapsed forms so it is hidden
// for consistency.
fullFormLink.addClass('element-hidden');
}
// Make all hidden fields visible when the trigger field comes into
// focus.
triggerField.find('textarea, input').focus(function () {
form.addClass('expanded-form').removeClass('compact-form');
toggle.removeClass('element-hidden');
hideables.removeClass('element-invisible');
fullFormLink.addClass('element-hidden');
});
// Hide all the hidden fields when the trigger link is clicked.
toggle.click(function () {
form.addClass('compact-form').removeClass('expanded-form');
toggle.addClass('element-hidden');
hideables.addClass('element-invisible');
fullFormLink.removeClass('element-hidden');
return false;
});
});
}
}
})(jQuery);

View File

@ -0,0 +1,42 @@
<?php
/**
* Plugins are described by creating a $plugin array which will be used
* by the system that includes this file.
*/
$plugin = array(
'title' => t('Commons Group Browsing widget'),
'description' => t('Commons Group Browsing widget.'),
'category' => t('Commons'),
'single' => TRUE,
'content type' => 'commons_bw_group',
'all contexts' => TRUE,
);
/**
* Output function for the '[content_type]' content type.
*/
function commons_bw_commons_bw_group_content_type_render($subtype, $conf, $panel_args, $context) {
$context = array_shift($context);
$node = !empty($context->data) ? $context->data : NULL;
$block = new stdClass();
$block->title = '';
$widget = commons_bw_generate_group_widget($node);
$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.
*/
function commons_bw_commons_bw_group_content_type_edit_form_submit($form, $form_state) {
return $form;
}

View File

@ -0,0 +1,149 @@
.quicktabs-style-commons-pills ul.quicktabs-tabs {
margin: 0 0 30px 0;
padding: 0;
}
.block-content .quicktabs-style-commons-pills ul.quicktabs-tabs {
padding: 0;
}
.quicktabs-style-commons-pills ul.quicktabs-tabs li {
display: inline-block;
padding: 0;
margin: 0 12px 0 0;
}
.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;
border-radius: 3px;
padding: 3px 10px 3px 6px;
display: block;
color: #a5a3a3;
}
.quicktabs-style-commons-pills ul.quicktabs-tabs li a:hover {
text-decoration: none;
}
.quicktabs-style-commons-pills ul.quicktabs-tabs li a span {
color: #3f3d3d;
font-size: .7em;
}
.quicktabs-style-commons-pills ul.quicktabs-tabs li.active a {
background-color: #00568c;
color: #fff;
position: relative;
}
.quicktabs-style-commons-pills ul.quicktabs-tabs li.active a:after {
content: '';
width: 0px;
height: 0px;
display: block;
border-style: solid;
border-width: 5px 7.5px 0 7.5px;
border-color: #00568c transparent transparent transparent;
position: absolute;
top: 100%;
left: 50%;
margin-left: -7.5px;
}
.quicktabs-style-commons-pills ul.quicktabs-tabs li.active a span {
color: #fff;
}
#quicktabs-tab-commons_bw-commons_all:before {
content: '';
background: url('images/icons-s2238b17da1.png') 0 -99px no-repeat;
width: 11px;
height: 11px;
display: inline-block;
margin-right: 3px;
position: relative;
top: 1px;
}
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_all:before {
background-position: 0 -163px;
}
#quicktabs-tab-commons_bw-commons_posts:before {
content: '';
background: url('images/icons-s2238b17da1.png') 0 -322px no-repeat;
width: 11px;
height: 11px;
display: inline-block;
margin-right: 3px;
position: relative;
top: 1px;
}
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_posts:before {
background-position: 0 -353px;
}
#quicktabs-tab-commons_bw-commons_documents:before {
content: '';
background: url('images/icons-s2238b17da1.png') 0 -384px no-repeat;
width: 9px;
height: 12px;
display: inline-block;
margin-right: 3px;
position: relative;
top: 1px;
}
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_documents:before {
background-position: 0 -416px;
}
#quicktabs-tab-commons_bw-commons_q_a:before {
content: '';
background: url('images/icons-s2238b17da1.png') 0 -66px no-repeat;
width: 13px;
height: 13px;
display: inline-block;
margin-right: 3px;
position: relative;
top: 1px;
}
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_q_a:before {
background-position: 0 -130px;
}
#quicktabs-tab-commons_bw-commons_ideas:before {
content: '';
background: url('images/icons-s2238b17da1.png') 0 -225px no-repeat;
width: 8px;
height: 13px;
display: inline-block;
margin-right: 3px;
position: relative;
top: 1px;
}
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_ideas:before {
background-position: 0 -289px;
}
#quicktabs-tab-commons_bw-commons_wikis:before {
content: '';
background: url('images/icons-s2238b17da1.png') 0 0 no-repeat;
width: 13px;
height: 13px;
display: inline-block;
margin-right: 3px;
position: relative;
top: 1px;
}
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_wikis:before {
background-position: 0 -33px;
}
#quicktabs-tab-commons_bw-commons_polls:before {
content: '';
background: url('images/icons-s2238b17da1.png') 0 -194px no-repeat;
width: 11px;
height: 11px;
display: inline-block;
margin-right: 3px;
position: relative;
top: 1px;
}
ul.quicktabs-style-commons-pills li.active #quicktabs-tab-commons_bw-commons_polls:before {
background-position: 0 -258px;
}

View File

@ -0,0 +1,155 @@
@import 'compass';
$icons: sprite-map('icons/*.png', $spacing: 20px);
@mixin sprite_url_height_width($sprite_name, $image_name) {
background: sprite($sprite_name, $image_name) no-repeat;
width: image-width(sprite-file($sprite_name, $image_name));
height: image-height(sprite-file($sprite_name, $image_name));
display: inline-block;
margin-right: 3px;
position: relative;
top: 1px;
}
@mixin sprite_url_position($sprite_name, $image_name) {
background-position: sprite-position($sprite_name, $image_name);
}
$link_color: #a5a3a3;
.quicktabs-style-commons-pills {
ul.quicktabs-tabs {
margin: 0 0 30px 0;
padding: 0;
.block-content & {
padding: 0;
}
li {
display: inline-block;
padding: 0;
margin: 0 12px 0 0;
a {
background-color: #f1f1f1;
@include border-radius(3px);
padding: 3px 10px 3px 6px;
display: block;
color: $link_color;
&:hover {
text-decoration: none;
}
span {
color: darken($link_color, 40%);
font-size: .7em;
}
}
&.active a {
background-color: #00568c;
color: #fff;
position: relative;
&:after {
content: '';
width: 0px;
height: 0px;
display: block;
border-style: solid;
border-width: 5px 7.5px 0 7.5px;
border-color: #00568c transparent transparent transparent;
position: absolute;
top: 100%;
left: 50%;
margin-left: -7.5px;
}
span {
color: #fff;
}
}
}
}
}
#quicktabs-tab-commons_bw-commons_all {
&:before {
content: '';
@include sprite_url_height_width($icons, all);
ul.quicktabs-style-commons-pills li.active & {
@include sprite_url_position($icons, all-active);
}
}
}
#quicktabs-tab-commons_bw-commons_posts {
&:before {
content: '';
@include sprite_url_height_width($icons, posts);
ul.quicktabs-style-commons-pills li.active & {
@include sprite_url_position($icons, posts-active);
}
}
}
#quicktabs-tab-commons_bw-commons_documents {
&:before {
content: '';
@include sprite_url_height_width($icons, docs);
ul.quicktabs-style-commons-pills li.active & {
@include sprite_url_position($icons, docs-active);
}
}
}
#quicktabs-tab-commons_bw-commons_q_a {
&:before {
content: '';
@include sprite_url_height_width($icons, qa);
ul.quicktabs-style-commons-pills li.active & {
@include sprite_url_position($icons, qa-active);
}
}
}
#quicktabs-tab-commons_bw-commons_ideas {
&:before {
content: '';
@include sprite_url_height_width($icons, ideas);
ul.quicktabs-style-commons-pills li.active & {
@include sprite_url_position($icons, ideas-active);
}
}
}
#quicktabs-tab-commons_bw-commons_wikis {
&:before {
content: '';
@include sprite_url_height_width($icons, wikis);
ul.quicktabs-style-commons-pills li.active & {
@include sprite_url_position($icons, wikis-active);
}
}
}
#quicktabs-tab-commons_bw-commons_polls {
&:before {
content: '';
@include sprite_url_height_width($icons, polls);
ul.quicktabs-style-commons-pills li.active & {
@include sprite_url_position($icons, polls-active);
}
}
}

View File

@ -0,0 +1,27 @@
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "/"
sass_dir = "/"
images_dir = "images"
# output_style = :expanded or :nested or :compact or :compressed
output_style = :expanded
environment = :production
relative_assets = true
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
color_output = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

View File

@ -0,0 +1,89 @@
.quicktabs-style-commons-tabs ul.quicktabs-tabs {
margin: 0;
padding: 0;
position: relative;
top: 1px;
}
.block-content .quicktabs-style-commons-tabs ul.quicktabs-tabs {
padding: 0;
}
.quicktabs-style-commons-tabs ul.quicktabs-tabs li {
display: inline-block;
padding: 0;
margin: 0 5px 0 0;
}
.quicktabs-style-commons-tabs ul.quicktabs-tabs li a {
background-color: #dddddd;
border: 1px solid #dddddd;
-webkit-border-radius: 3px 3px 0 0;
-moz-border-radius: 3px 3px 0 0;
-ms-border-radius: 3px 3px 0 0;
-o-border-radius: 3px 3px 0 0;
border-radius: 3px 3px 0 0;
padding: 10px;
display: block;
font-size: 1.1em;
color: #2683b8;
}
.quicktabs-style-commons-tabs ul.quicktabs-tabs li a:hover {
text-decoration: none;
}
.quicktabs-style-commons-tabs ul.quicktabs-tabs li a span {
background: #dddddd;
font-size: 1.1em;
line-height: 1.1em;
color: #4d4d4d;
font-style: italic;
display: inline-block;
padding: 2px 6px;
border: 1px solid #c4c4c4;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
margin-left: 2px;
}
.quicktabs-style-commons-tabs ul.quicktabs-tabs li.active a {
background-color: #f1f1f1;
color: #333333;
border-bottom-color: #f1f1f1;
}
.quicktabs-style-commons-tabs .quicktabs-tabpage {
border: 1px solid #dddddd;
background-color: #f1f1f1;
-webkit-border-radius: 0 3px 3px 3px;
-moz-border-radius: 0 3px 3px 3px;
-ms-border-radius: 0 3px 3px 3px;
-o-border-radius: 0 3px 3px 3px;
border-radius: 0 3px 3px 3px;
padding: 10px;
}
.quicktabs-style-commons-tabs table {
margin-top: 0;
border: none;
}
.quicktabs-style-commons-tabs td {
padding: 10px 7px;
}
.quicktabs-style-commons-tabs tbody tr {
border-top: none;
}
.quicktabs-style-commons-tabs tr {
background: none;
}
.quicktabs-style-commons-tabs tr.odd {
background: none;
}
.quicktabs-style-commons-tabs tr.even {
background: #ececec;
}
.quicktabs-style-commons-tabs tr.even, .quicktabs-style-commons-tabs tr.odd {
border-bottom: 1px dashed #dddddd;
}
.quicktabs-style-commons-tabs tr.even.views-row-last, .quicktabs-style-commons-tabs tr.odd.views-row-last {
border-bottom: none;
}
.quicktabs-style-commons-tabs tr.even td.active, .quicktabs-style-commons-tabs tr.odd td.active {
background: none;
}

View File

@ -0,0 +1,108 @@
@import 'compass';
$link_color: #2683B8;
$gray: #f1f1f1;
$gray_darker: #ececec;
$gray_darkest: #dddddd;
$black: #333333;
.quicktabs-style-commons-tabs {
ul.quicktabs-tabs {
margin: 0;
padding: 0;
position: relative;
top: 1px;
.block-content & {
padding: 0;
}
li {
display: inline-block;
padding: 0;
margin: 0 5px 0 0;
a {
background-color: $gray_darkest;
border: 1px solid $gray_darkest;
@include border-radius(3px 3px 0 0);
padding: 10px;
display: block;
font-size: 1.1em;
color: $link_color;
&:hover {
text-decoration: none;
}
span {
background: $gray_darkest;
font-size: 1.1em;
line-height: 1.1em;
color: lighten($black, 10%);
font-style: italic;
display: inline-block;
padding: 2px 6px;
border: 1px solid darken($gray_darkest, 10%);
@include border-radius(3px);
margin-left: 2px;
}
}
&.active a {
background-color: $gray;
color: $black;
border-bottom-color: $gray;
span {
// color: #fff;
}
}
}
}
.quicktabs-tabpage {
border: 1px solid $gray_darkest;
background-color: $gray;
@include border-radius(0 3px 3px 3px);
padding: 10px
}
table {
margin-top: 0;
border: none;
}
td {
padding: 10px 7px;
}
tbody tr {
border-top: none;
}
tr {
background: none;
&.odd {
background: none;
}
&.even {
background: $gray_darker;
}
&.even, &.odd {
border-bottom: 1px dashed $gray_darkest;
&.views-row-last {
border-bottom: none;
}
& td.active {
background: none;
}
}
}
}

View File

@ -0,0 +1,26 @@
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "/"
sass_dir = "/"
# output_style = :expanded or :nested or :compact or :compressed
output_style = :expanded
environment = :production
relative_assets = true
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# To disable debugging comments that display the original location of your selectors. Uncomment:
# line_comments = false
color_output = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass

View File

@ -0,0 +1,115 @@
<?php
/**
* @file
* commons_content_moderation.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function commons_content_moderation_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}
/**
* Implements hook_views_api().
*/
function commons_content_moderation_views_api($module = NULL, $api = NULL) {
return array("api" => "3.0");
}
/**
* Implements hook_flag_default_flags().
*/
function commons_content_moderation_flag_default_flags() {
$flags = array();
// Exported flag: "Comment inappropriate".
$flags['inappropriate_comment'] = array(
'content_type' => 'comment',
'title' => 'Comment inappropriate',
'global' => 0,
'types' => array(
0 => 'comment_node_answer',
1 => 'comment_node_event',
2 => 'comment_node_group',
3 => 'comment_node_page',
4 => 'comment_node_post',
5 => 'comment_node_question',
6 => 'comment_node_wiki',
),
'flag_short' => 'Report as inappropriate',
'flag_long' => 'Report this comment as inappropriate.',
'flag_message' => '',
'unflag_short' => 'Cancel report as inappropriate',
'unflag_long' => 'Cancel reporting as inappropriate.',
'unflag_message' => '',
'unflag_denied_text' => '',
'link_type' => 'confirm',
'roles' => array(
'flag' => array(
0 => 2,
),
'unflag' => array(
0 => 2,
),
),
'weight' => 0,
'show_on_form' => 0,
'access_author' => 'comment_others',
'show_on_comment' => 1,
'flag_confirmation' => 'Are you sure you want to report this comment as inappropriate?',
'unflag_confirmation' => 'Are you sure you want to cancel reporting this comment as inappropriate?',
'module' => 'commons_content_moderation',
'locked' => array(
0 => 'name',
),
'api_version' => 2,
);
// Exported flag: "Node inappropriate".
$flags['inappropriate_node'] = array(
'content_type' => 'node',
'title' => 'Node inappropriate',
'global' => 0,
'types' => array(
0 => 'event',
1 => 'group',
2 => 'page',
3 => 'post',
4 => 'wiki',
),
'flag_short' => 'Report as inappropriate',
'flag_long' => 'Report this content as inappropriate.',
'flag_message' => '',
'unflag_short' => 'Cancel report as inappropriate',
'unflag_long' => 'Report this content as appropriate',
'unflag_message' => '',
'unflag_denied_text' => '',
'link_type' => 'confirm',
'roles' => array(
'flag' => array(
0 => 2,
),
'unflag' => array(
0 => 2,
),
),
'weight' => 0,
'show_on_form' => 0,
'access_author' => '',
'show_on_page' => 1,
'show_on_teaser' => 0,
'show_contextual_link' => FALSE,
'i18n' => 0,
'flag_confirmation' => 'Are you sure you want to report this content as inappropriate?',
'unflag_confirmation' => 'Are you sure you want cancel reporting this content as inappropriate?',
'module' => 'commons_content_moderation',
'locked' => array(
0 => 'name',
),
'api_version' => 2,
);
return $flags;
}

View File

@ -0,0 +1,20 @@
<?php
/**
* @file
* commons_content_moderation.features.user_role.inc
*/
/**
* Implements hook_user_default_roles().
*/
function commons_content_moderation_user_default_roles() {
$roles = array();
// Exported role: content moderator.
$roles['content moderator'] = array(
'name' => 'content moderator',
'weight' => 2,
);
return $roles;
}

View File

@ -0,0 +1,19 @@
name = Commons Content moderation
description = Commons Content moderation
core = 7.x
package = Commons - Building Blocks
dependencies[] = ctools
dependencies[] = flag
dependencies[] = flag_abuse
dependencies[] = strongarm
dependencies[] = views
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[flag][] = inappropriate_comment
features[flag][] = inappropriate_node
features[user_role][] = content moderator
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

View File

@ -0,0 +1,19 @@
<?php
/**
* Change content moderation views permission.
*/
function commons_content_moderation_update_7001() {
$revert = array(
'commons_content_moderation' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Clear views cache to have content moderation view use new permission.
*/
function commons_content_moderation_update_7002() {
cache_clear_all('*', 'cache_views', TRUE);
}

View File

@ -0,0 +1,139 @@
<?php
/**
* @file
* Code for the Commons Content Moderation feature.
*/
include_once 'commons_content_moderation.features.inc';
/**
* Implements hook_action_info().
*/
function commons_content_moderation_action_info() {
return array(
'commons_content_moderation_delete_node_block_user' => array(
'type' => 'node',
'label' => t("Delete content and block author's account."),
'configurable' => FALSE,
'behavior' => array(''),
'triggers' => array(''),
),
'commons_content_moderation_delete_comment_block_user' => array(
'type' => 'comment',
'label' => t("Delete comment and block author's account."),
'configurable' => FALSE,
'behavior' => array(''),
'triggers' => array(''),
),
);
}
/**
* Delete content and block the content author.
*
* @param $node
* A node object.
* @param $context
* (optional) Array of additional information about what triggered the action.
* Not used for this action.
*
* @ingroup actions
*/
function commons_content_moderation_delete_node_block_user($node, $context = array()) {
// Don't block anonymous users or user 1.
if ($node->uid > 1) {
$author = user_load($node->uid);
// Block the user if they aren't already.
if ($author->status) {
$author = user_save($author, array('status' => 0));
watchdog('commons_content_moderation', 'Blocked user %name.', array('%name' => format_username($author)));
}
}
// Report the content to Mollom when possible.
if (module_exists('mollom') && _mollom_flag_access('node', $node)) {
mollom_data_report('node', $node->nid, 'spam');
}
// Delete the node.
node_delete($node->nid);
watchdog('commons_content_moderation', 'Deleted @type %title.', array('@type' => node_type_get_name($node), '%title' => $node->title));
}
/**
* Delete comment and block the comment author.
*
* @param $comment
* A comment object.
* @param $context
* (optional) Array of additional information about what triggered the action.
* Not used for this action.
*
* @ingroup actions
*/
function commons_content_moderation_delete_comment_block_user($comment, $context = array()) {
// Don't block anonymous users or user 1.
if ($comment->uid > 1) {
$author = user_load($comment->uid);
// Block the user if they aren't already.
if ($author->status) {
$author = user_save($author, array('status' => 0));
watchdog('commons_content_moderation', 'Blocked user %name.', array('%name' => format_username($author)));
}
}
// Report the content to Mollom when possible.
if (module_exists('mollom') && _mollom_flag_access('comment', $comment)) {
mollom_data_report('comment', $comment->cid, 'spam');
}
// Delete the comment.
comment_delete($comment->cid);
watchdog('commons_content_moderation', 'Deleted comment %title.', array('%title' => $comment->title));
}
/**
* Implements hook_views_default_views_alter().
*/
function commons_content_moderation_views_default_views_alter(&$views) {
// Disable default node and comment abuse views in favor of Commons-specific
// views included with Commons Content Moderation.
foreach (array('all_flag_abuse_node', 'all_flag_abuse_comment') as $view_name) {
if (!empty($views[$view_name])) {
$views[$view_name]->disabled = TRUE;
}
}
}
/**
* Implements hook_views_pre_build().
*/
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'))) {
unset($view->field['views_bulk_operations']);
unset($view->display_handler->handlers['field']['views_bulk_operations']);
}
}
/**
* Implements hook_views_bulk_operations_form_alter().
*/
function commons_content_moderation_views_bulk_operations_form_alter(&$form, $form_state, $vbo) {
// Only proceed if the 'delete_node_block_user' operation is available.
if (!isset($vbo->options['vbo_operations']['action::commons_content_moderation_delete_node_block_user'])) {
return;
}
// Notify the user that the deleted content will be reported to Mollom.
if ($form_state['step'] == 'views_form_views_form' && $vbo->options['vbo_operations']['action::commons_content_moderation_delete_node_block_user']['selected'] == 1) {
if (module_exists('mollom') && _mollom_access('report to mollom')) {
$form['mollom_text'] = array(
'#markup' => '<p>' . t('Deleted content will be reported to Mollom.') . '</p>',
);
}
}
}

View File

@ -0,0 +1,30 @@
<?php
/**
* @file
* commons_content_moderation.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function commons_content_moderation_strongarm() {
$export = array();
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'flag_abuse_flags';
$strongarm->value = array(
'inappropriate_node' => 'inappropriate_node',
'inappropriate_comment' => 'inappropriate_comment',
'commons_follow_user' => 0,
'commons_follow_term' => 0,
'commons_follow_group' => 0,
'commons_follow_node' => 0,
'bookmarks' => 0,
'abuse_user' => 0,
);
$export['flag_abuse_flags'] = $strongarm;
return $export;
}

View File

@ -0,0 +1,632 @@
<?php
/**
* @file
* commons_content_moderation.views_default.inc
*/
/**
* Implements hook_views_default_views().
*/
function commons_content_moderation_views_default_views() {
$export = array();
$view = new view();
$view->name = 'commons_content_moderation_reported_comments';
$view->description = 'View for flag: Comment Abuse ';
$view->tag = 'flag.abuse';
$view->base_table = 'comment';
$view->human_name = 'Commons reported comments';
$view->core = 0;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['title'] = 'Comments';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'administer nodes';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = 25;
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'subject' => 'subject',
'title' => 'title',
'count' => 'count',
'last_updated' => 'last_updated',
'name_2' => 'name_2',
'entity_id' => 'entity_id',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
'subject' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'title' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'count' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'last_updated' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'name_2' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'entity_id' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['text']['id'] = 'text';
$handler->display->display_options['empty']['text']['table'] = 'views';
$handler->display->display_options['empty']['text']['field'] = 'area';
$handler->display->display_options['empty']['text']['content'] = 'No comments have been reported...';
$handler->display->display_options['empty']['text']['format'] = 'plain_text';
/* Relationship: Flags: inappropriate_comment */
$handler->display->display_options['relationships']['flag_content_rel']['id'] = 'flag_content_rel';
$handler->display->display_options['relationships']['flag_content_rel']['table'] = 'comment';
$handler->display->display_options['relationships']['flag_content_rel']['field'] = 'flag_content_rel';
$handler->display->display_options['relationships']['flag_content_rel']['flag'] = 'inappropriate_comment';
$handler->display->display_options['relationships']['flag_content_rel']['user_scope'] = 'any';
/* Relationship: Comment: Content */
$handler->display->display_options['relationships']['nid']['id'] = 'nid';
$handler->display->display_options['relationships']['nid']['table'] = 'comment';
$handler->display->display_options['relationships']['nid']['field'] = 'nid';
$handler->display->display_options['relationships']['nid']['required'] = TRUE;
/* Relationship: Flags: inappropriate_comment counter */
$handler->display->display_options['relationships']['flag_count_rel']['id'] = 'flag_count_rel';
$handler->display->display_options['relationships']['flag_count_rel']['table'] = 'comment';
$handler->display->display_options['relationships']['flag_count_rel']['field'] = 'flag_count_rel';
$handler->display->display_options['relationships']['flag_count_rel']['flag'] = 'inappropriate_comment';
/* Field: Bulk operations: Comment */
$handler->display->display_options['fields']['views_bulk_operations']['id'] = 'views_bulk_operations';
$handler->display->display_options['fields']['views_bulk_operations']['table'] = 'comment';
$handler->display->display_options['fields']['views_bulk_operations']['field'] = 'views_bulk_operations';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['display_type'] = '1';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['enable_select_all_pages'] = 1;
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['force_single'] = 0;
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_operations'] = array(
'action::commons_content_moderation_delete_comment_block_user' => array(
'selected' => 1,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::views_bulk_operations_delete_item' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::system_message_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::views_bulk_operations_script_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::flag_comment_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::views_bulk_operations_modify_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'settings' => array(
'show_all_tokens' => 1,
'display_values' => array(
'_all_' => '_all_',
),
),
'postpone_processing' => 0,
),
'action::views_bulk_operations_argument_selector_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'settings' => array(
'url' => '',
),
),
'action::comment_publish_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::system_goto_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::comment_save_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::system_send_email_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::panelizer_set_status_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::comment_unpublish_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::comment_unpublish_by_keyword_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
);
/* Field: Comment: Title */
$handler->display->display_options['fields']['subject']['id'] = 'subject';
$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';
/* Field: Comment: Author */
$handler->display->display_options['fields']['name_2']['id'] = 'name_2';
$handler->display->display_options['fields']['name_2']['table'] = 'comment';
$handler->display->display_options['fields']['name_2']['field'] = 'name';
$handler->display->display_options['fields']['name_2']['label'] = 'Comment Author';
/* Field: Comment: Comment */
$handler->display->display_options['fields']['entity_id']['id'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['table'] = 'field_data_comment_body';
$handler->display->display_options['fields']['entity_id']['field'] = 'comment_body';
/* Sort criterion: Flags: Flagged time */
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content';
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
/* Filter criterion: Comment: Approved */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'comment';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = '1';
/* Display: Page: Reported comments */
$handler = $view->new_display('page', 'Page: Reported comments', 'page_abuse_comment');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['path'] = 'admin/content/comment/reported';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'Reported comments';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['tab_options']['type'] = 'tab';
$handler->display->display_options['tab_options']['title'] = 'Reported comments';
$handler->display->display_options['tab_options']['weight'] = '10';
$translatables['commons_content_moderation_reported_comments'] = array(
t('Defaults'),
t('Comments'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Items per page'),
t('- All -'),
t('Offset'),
t('« first'),
t(' previous'),
t('next '),
t('last »'),
t('No comments have been reported...'),
t('flag'),
t('Content'),
t('counter'),
t('Comment'),
t('Title'),
t('Comment on'),
t('Comment Author'),
t('Page: Reported comments'),
);
$export['commons_content_moderation_reported_comments'] = $view;
$view = new view();
$view->name = 'commons_content_moderation_reported_nodes';
$view->description = 'View for flag: Node Abuse';
$view->tag = 'flag.abuse';
$view->base_table = 'node';
$view->human_name = 'Commons reported nodes';
$view->core = 0;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['title'] = 'Reported content';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'administer nodes';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['distinct'] = TRUE;
$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(
'views_bulk_operations' => 'views_bulk_operations',
'type' => 'type',
'title' => 'title',
'count' => 'count',
'last_updated' => 'last_updated',
'name' => 'name',
'body' => 'body',
);
$handler->display->display_options['style_options']['default'] = 'last_updated';
$handler->display->display_options['style_options']['info'] = array(
'views_bulk_operations' => array(
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'type' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'title' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'count' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'last_updated' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'name' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'body' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['text']['id'] = 'area';
$handler->display->display_options['empty']['text']['table'] = 'views';
$handler->display->display_options['empty']['text']['field'] = 'area';
$handler->display->display_options['empty']['text']['content'] = 'No content has been reported.';
$handler->display->display_options['empty']['text']['format'] = '1';
/* Relationship: Flags: inappropriate_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']['label'] = 'abuse_node';
$handler->display->display_options['relationships']['flag_content_rel']['flag'] = 'inappropriate_node';
$handler->display->display_options['relationships']['flag_content_rel']['user_scope'] = 'any';
/* Relationship: Content: Author */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'node';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
$handler->display->display_options['relationships']['uid']['required'] = TRUE;
/* Relationship: Flags: inappropriate_node counter */
$handler->display->display_options['relationships']['flag_count_rel']['id'] = 'flag_count_rel';
$handler->display->display_options['relationships']['flag_count_rel']['table'] = 'node';
$handler->display->display_options['relationships']['flag_count_rel']['field'] = 'flag_count_rel';
$handler->display->display_options['relationships']['flag_count_rel']['flag'] = 'inappropriate_node';
/* Field: Bulk operations: Content */
$handler->display->display_options['fields']['views_bulk_operations']['id'] = 'views_bulk_operations';
$handler->display->display_options['fields']['views_bulk_operations']['table'] = 'node';
$handler->display->display_options['fields']['views_bulk_operations']['field'] = 'views_bulk_operations';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['display_type'] = '1';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['enable_select_all_pages'] = 1;
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['force_single'] = 0;
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10';
$handler->display->display_options['fields']['views_bulk_operations']['vbo_operations'] = array(
'action::node_assign_owner_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::commons_content_moderation_delete_node_block_user' => array(
'selected' => 1,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::views_bulk_operations_delete_item' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::system_message_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::views_bulk_operations_script_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::flag_node_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::node_make_sticky_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::node_make_unsticky_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::views_bulk_operations_modify_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'settings' => array(
'show_all_tokens' => 1,
'display_values' => array(
'_all_' => '_all_',
),
),
'postpone_processing' => 0,
),
'action::views_bulk_operations_argument_selector_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'settings' => array(
'url' => '',
),
),
'action::node_promote_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::node_publish_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::system_goto_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::node_unpromote_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::node_save_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::system_send_email_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::panelizer_set_status_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::node_unpublish_action' => array(
'selected' => 1,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
'action::node_unpublish_by_keyword_action' => array(
'selected' => 0,
'skip_confirmation' => 0,
'override_label' => 0,
'label' => '',
'postpone_processing' => 0,
),
);
/* Field: Content: Type */
$handler->display->display_options['fields']['type']['id'] = 'type';
$handler->display->display_options['fields']['type']['table'] = 'node';
$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';
/* Field: Flags: Flag counter */
$handler->display->display_options['fields']['count']['id'] = 'count';
$handler->display->display_options['fields']['count']['table'] = 'flag_counts';
$handler->display->display_options['fields']['count']['field'] = 'count';
$handler->display->display_options['fields']['count']['relationship'] = 'flag_count_rel';
$handler->display->display_options['fields']['count']['label'] = '# of Reports';
/* Field: Flags: Time last flagged */
$handler->display->display_options['fields']['last_updated']['id'] = 'last_updated';
$handler->display->display_options['fields']['last_updated']['table'] = 'flag_counts';
$handler->display->display_options['fields']['last_updated']['field'] = 'last_updated';
$handler->display->display_options['fields']['last_updated']['relationship'] = 'flag_count_rel';
$handler->display->display_options['fields']['last_updated']['label'] = 'Last reported';
$handler->display->display_options['fields']['last_updated']['date_format'] = 'time ago';
/* 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'] = 'Author';
/* Field: Content: Body */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
$handler->display->display_options['fields']['body']['type'] = 'text_summary_or_trimmed';
$handler->display->display_options['fields']['body']['settings'] = array(
'trim_length' => '600',
);
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = '0';
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['path'] = 'admin/content/reported';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'Reported content';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['name'] = 'management';
$handler->display->display_options['menu']['context'] = 0;
$handler->display->display_options['tab_options']['title'] = 'Reported content';
$handler->display->display_options['tab_options']['weight'] = '';
$translatables['commons_content_moderation_reported_nodes'] = array(
t('Defaults'),
t('Reported content'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('No content has been reported.'),
t('abuse_node'),
t('author'),
t('counter'),
t('Content'),
t('Type'),
t('Title'),
t('# of Reports'),
t('.'),
t(','),
t('Last reported'),
t('Author'),
t('Body'),
t('Page'),
);
$export['commons_content_moderation_reported_nodes'] = $view;
return $export;
}

View File

@ -0,0 +1,45 @@
<?php
/**
* @file
* commons_documents.features.field_base.inc
*/
/**
* Implements hook_field_default_field_bases().
*/
function commons_documents_field_default_field_bases() {
$field_bases = array();
// Exported field_base: 'field_document_file'
$field_bases['field_document_file'] = array(
'active' => 1,
'cardinality' => -1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_document_file',
'foreign keys' => array(
'fid' => array(
'columns' => array(
'fid' => 'fid',
),
'table' => 'file_managed',
),
),
'indexes' => array(
'fid' => array(
0 => 'fid',
),
),
'locked' => 0,
'module' => 'file',
'settings' => array(
'display_default' => 1,
'display_field' => 0,
'uri_scheme' => 'public',
),
'translatable' => 0,
'type' => 'file',
);
return $field_bases;
}

View File

@ -0,0 +1,107 @@
<?php
/**
* @file
* commons_documents.features.field_instance.inc
*/
/**
* Implements hook_field_default_field_instances().
*/
function commons_documents_field_default_field_instances() {
$field_instances = array();
// Exported field_instance: 'node-document-body'
$field_instances['node-document-body'] = array(
'bundle' => 'document',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 2,
),
'teaser' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(
'trim_length' => 600,
),
'type' => 'text_summary_or_trimmed',
'weight' => 1,
),
),
'display_in_partial_form' => 1,
'entity_type' => 'node',
'field_name' => 'body',
'label' => 'Body',
'required' => FALSE,
'settings' => array(
'display_summary' => FALSE,
'text_processing' => 1,
'user_register_form' => FALSE,
),
'widget' => array(
'module' => 'text',
'settings' => array(
'rows' => 20,
'summary_rows' => 5,
),
'type' => 'text_textarea_with_summary',
'weight' => 1,
),
);
// Exported field_instance: 'node-document-field_document_file'
$field_instances['node-document-field_document_file'] = array(
'bundle' => 'document',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'file',
'settings' => array(),
'type' => 'file_default',
'weight' => 4,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'display_in_partial_form' => 1,
'entity_type' => 'node',
'field_name' => 'field_document_file',
'label' => 'File',
'required' => 1,
'settings' => array(
'description_field' => 1,
'file_directory' => '',
'file_extensions' => 'txt doc docx xls xlsx ppt pptx odt odp ods pdf',
'max_filesize' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'file',
'settings' => array(
'progress_indicator' => 'throbber',
),
'type' => 'file_generic',
'weight' => 2,
),
);
// Translatables
// Included for use with string extractors like potx.
t('Body');
t('File');
return $field_instances;
}

View File

@ -0,0 +1,38 @@
<?php
/**
* @file
* commons_documents.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function commons_documents_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}
/**
* Implements hook_views_api().
*/
function commons_documents_views_api($module = NULL, $api = NULL) {
return array("api" => "3.0");
}
/**
* Implements hook_node_info().
*/
function commons_documents_node_info() {
$items = array(
'document' => array(
'name' => t('Document'),
'base' => 'node_content',
'description' => t('Upload and display files or attachments to share with others.'),
'has_title' => '1',
'title_label' => t('Title'),
'help' => '',
),
);
return $items;
}

View File

@ -0,0 +1,52 @@
<?php
/**
* @file
* commons_documents.features.og_features_permission.inc
*/
/**
* Implements hook_og_features_default_permissions().
*/
function commons_documents_og_features_default_permissions() {
$permissions = array();
// Exported og permission: 'node:group:create document content'
$permissions['node:group:create document content'] = array(
'roles' => array(
'administrator member' => 'administrator member',
'member' => 'member',
),
);
// Exported og permission: 'node:group:delete any document content'
$permissions['node:group:delete any document content'] = array(
'roles' => array(
'administrator member' => 'administrator member',
),
);
// Exported og permission: 'node:group:delete own document content'
$permissions['node:group:delete own document content'] = array(
'roles' => array(
'administrator member' => 'administrator member',
'member' => 'member',
),
);
// Exported og permission: 'node:group:update any document content'
$permissions['node:group:update any document content'] = array(
'roles' => array(
'administrator member' => 'administrator member',
),
);
// Exported og permission: 'node:group:update own document content'
$permissions['node:group:update own document content'] = array(
'roles' => array(
'administrator member' => 'administrator member',
'member' => 'member',
),
);
return $permissions;
}

View File

@ -0,0 +1,62 @@
<?php
/**
* @file
* commons_documents.features.user_permission.inc
*/
/**
* Implements hook_user_default_permissions().
*/
function commons_documents_user_default_permissions() {
$permissions = array();
// Exported permission: 'create document content'.
$permissions['create document content'] = array(
'name' => 'create document content',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'node',
);
// Exported permission: 'delete any document content'.
$permissions['delete any document content'] = array(
'name' => 'delete any document content',
'roles' => array(
'administrator' => 'administrator',
),
'module' => 'node',
);
// Exported permission: 'delete own document content'.
$permissions['delete own document content'] = array(
'name' => 'delete own document content',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'node',
);
// Exported permission: 'edit any document content'.
$permissions['edit any document content'] = array(
'name' => 'edit any document content',
'roles' => array(
'administrator' => 'administrator',
),
'module' => 'node',
);
// Exported permission: 'edit own document content'.
$permissions['edit own document content'] = array(
'name' => 'edit own document content',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'node',
);
return $permissions;
}

View File

@ -0,0 +1,46 @@
name = Commons Documents
core = 7.x
package = Commons - Content types
dependencies[] = commons_body
dependencies[] = commons_groups
dependencies[] = commons_topics
dependencies[] = ctools
dependencies[] = entityreference
dependencies[] = features
dependencies[] = file
dependencies[] = og
dependencies[] = og_ui
dependencies[] = strongarm
dependencies[] = views
dependencies[] = views_litepager
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[field_base][] = field_document_file
features[field_instance][] = node-document-body
features[field_instance][] = node-document-field_document_file
features[node][] = document
features[og_features_permission][] = node:group:create document content
features[og_features_permission][] = node:group:delete any document content
features[og_features_permission][] = node:group:delete own document content
features[og_features_permission][] = node:group:update any document content
features[og_features_permission][] = node:group:update own document content
features[user_permission][] = create document content
features[user_permission][] = delete any document content
features[user_permission][] = delete own document content
features[user_permission][] = edit any document content
features[user_permission][] = edit own document content
features[variable][] = comment_anonymous_document
features[variable][] = comment_default_mode_document
features[variable][] = comment_default_per_page_document
features[variable][] = comment_document
features[variable][] = comment_form_location_document
features[variable][] = comment_preview_document
features[variable][] = comment_subject_field_document
features[variable][] = field_bundle_settings_node__document
features[variable][] = menu_options_document
features[variable][] = menu_parent_document
features[variable][] = node_options_document
features[variable][] = node_preview_document
features[variable][] = node_submitted_document
features[views_view][] = commons_bw_documents

View File

@ -0,0 +1,89 @@
<?php
/**
* Disable summary on Document nodes.
*/
function commons_documents_update_7000() {
$revert = array(
'commons_documents' => array('field_instance'),
);
features_revert($revert);
return array();
}
/**
* Disable default frontpage promotion of Document nodes.
*/
function commons_documents_update_7001() {
$revert = array(
'commons_documents' => array('variable'),
);
features_revert($revert);
return array();
}
/**
* Remove unused view displays.
*/
function commons_documents_update_7002() {
$revert = array(
'commons_documents' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Standardize Browsing Widget views.
*/
function commons_documents_update_7003() {
$revert = array(
'commons_documents' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Display sticky content at top of lists.
*/
function commons_documents_update_7004() {
$revert = array(
'commons_documents' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Add .txt to the list of allowed file extensions.
*/
function commons_documents_update_7005() {
$revert = array(
'commons_documents' => array('field_instance'),
);
features_revert($revert);
return array();
}
/**
* Add links to node teasers in the browsing widget.
*/
function commons_documents_update_7006() {
$revert = array(
'commons_documents' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Improve the browsing widget empty text.
*/
function commons_documents_update_7007() {
$revert = array(
'commons_documents' => array('views_view'),
);
features_revert($revert);
return array();
}

View File

@ -0,0 +1,97 @@
<?php
/**
* @file
* Code for the Commons Documents feature.
*/
include_once 'commons_documents.features.inc';
/**
* 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',
),
);
}
/**
* Implements hook_form_FROM_ID_alter().
*/
function commons_documents_form_commons_bw_partial_node_form_alter(&$form, &$form_state) {
if (empty($form['#entity']) || $form['#entity']->type != 'document') {
return;
}
$language = $form['body']['#language'];
$form['body'][$language][0]['#title_display'] = 'invisible';
$form['body'][$language][0]['#required'] = TRUE;
$form['body'][$language][0]['#placeholder'] = t('Describe the document');
$form['body'][$language][0]['#resizable'] = FALSE;
// Set fields as hideable so the forms can be compacted.
$form['body']['#attributes']['class'][] = 'trigger-field';
foreach (array('field_image', 'og_group_ref', 'field_document_file', 'actions') as $field) {
if (isset($form[$field])) {
$form[$field]['#attributes']['class'][] = 'hideable-field';
}
}
$form['#pre_render'][] = 'commons_documents_form_commons_bw_partial_node_form_after_build';
}
/**
* After-build call-back.
* See commons_documents_form_commons_bw_partial_node_form_alter().
*/
function commons_documents_form_commons_bw_partial_node_form_after_build($form) {
$language = $form['body']['#language'];
$form['body'][$language][0]['#pre_render'] = array();
$form['body'][$language][0]['format']['#access'] = FALSE;
$form['body'][$language][0]['value']['#rows'] = 3;
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().
*/
function commons_documents_views_pre_render(&$view) {
// Improve the browsing widget empty text when displayed outside of a group.
// TODO: Enable og_context and check group context instead of looking for an
// empty first argument.
if (empty($view->args[0]) && $view->name == 'commons_bw_documents') {
$view->display_handler->handlers['empty']['area']->options['content'] = t('No documents have been created.');
}
}

View File

@ -0,0 +1,119 @@
<?php
/**
* @file
* commons_documents.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function commons_documents_strongarm() {
$export = array();
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_anonymous_document';
$strongarm->value = 0;
$export['comment_anonymous_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_default_mode_document';
$strongarm->value = 1;
$export['comment_default_mode_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_default_per_page_document';
$strongarm->value = '50';
$export['comment_default_per_page_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_document';
$strongarm->value = '2';
$export['comment_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_form_location_document';
$strongarm->value = 1;
$export['comment_form_location_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_preview_document';
$strongarm->value = '1';
$export['comment_preview_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_subject_field_document';
$strongarm->value = 1;
$export['comment_subject_field_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'field_bundle_settings_node__document';
$strongarm->value = array(
'view_modes' => array(),
'extra_fields' => array(
'form' => array(
'title' => array(
'weight' => '0',
),
),
'display' => array(),
),
);
$export['field_bundle_settings_node__document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'menu_options_document';
$strongarm->value = array(
0 => 'main-menu',
);
$export['menu_options_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'menu_parent_document';
$strongarm->value = 'main-menu:0';
$export['menu_parent_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'node_options_document';
$strongarm->value = array(
0 => 'status',
);
$export['node_options_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'node_preview_document';
$strongarm->value = '1';
$export['node_preview_document'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'node_submitted_document';
$strongarm->value = 1;
$export['node_submitted_document'] = $strongarm;
return $export;
}

View File

@ -0,0 +1,135 @@
<?php
/**
* @file
* commons_documents.views_default.inc
*/
/**
* Implements hook_views_default_views().
*/
function commons_documents_views_default_views() {
$export = array();
$view = new view();
$view->name = 'commons_bw_documents';
$view->description = 'Commons Documents listing for the group browsing widget.';
$view->tag = 'Commons Documents, Commons Browsing Widget';
$view->base_table = 'node';
$view->human_name = 'Commons Browsing Widget - Documents';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['use_ajax'] = TRUE;
$handler->display->display_options['use_more_always'] = FALSE;
$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['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'lite';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '5';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* Header: Global: Node partial form */
$handler->display->display_options['header']['commons_bw_node_partial_form']['id'] = 'commons_bw_node_partial_form';
$handler->display->display_options['header']['commons_bw_node_partial_form']['table'] = 'views';
$handler->display->display_options['header']['commons_bw_node_partial_form']['field'] = 'commons_bw_node_partial_form';
$handler->display->display_options['header']['commons_bw_node_partial_form']['bundle'] = 'document';
/* 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';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = 'No documents have been added to this group.';
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
/* Relationship: OG membership: OG membership from Node */
$handler->display->display_options['relationships']['og_membership_rel']['id'] = 'og_membership_rel';
$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;
/* 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: Sticky */
$handler->display->display_options['sorts']['sticky']['id'] = 'sticky';
$handler->display->display_options['sorts']['sticky']['table'] = 'node';
$handler->display->display_options['sorts']['sticky']['field'] = 'sticky';
$handler->display->display_options['sorts']['sticky']['order'] = 'DESC';
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
$handler->display->display_options['sorts']['created']['exposed'] = TRUE;
$handler->display->display_options['sorts']['created']['expose']['label'] = 'Post date';
/* Contextual filter: OG membership: Group ID */
$handler->display->display_options['arguments']['gid']['id'] = 'gid';
$handler->display->display_options['arguments']['gid']['table'] = 'og_membership';
$handler->display->display_options['arguments']['gid']['field'] = 'gid';
$handler->display->display_options['arguments']['gid']['relationship'] = 'og_membership_rel';
$handler->display->display_options['arguments']['gid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['gid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['gid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['gid']['summary_options']['items_per_page'] = '25';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$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: Content: Type */
$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(
'document' => 'document',
);
$handler->display->display_options['filters']['type']['group'] = 1;
/* 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';
$handler->display->display_options['filters']['group_type']['field'] = 'group_type';
$handler->display->display_options['filters']['group_type']['relationship'] = 'og_membership_rel';
$handler->display->display_options['filters']['group_type']['value'] = array(
'node' => 'node',
);
$handler->display->display_options['filters']['group_type']['group'] = 1;
$translatables['commons_bw_documents'] = array(
t('Master'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Items per page'),
t('- All -'),
t('Offset'),
t('« first'),
t(' previous'),
t('next '),
t('last »'),
t('No documents have been added to this group.'),
t('OG membership from node'),
t('following'),
t('Post date'),
t('most active'),
t('All'),
t('Following'),
);
$export['commons_bw_documents'] = $view;
return $export;
}

View File

@ -0,0 +1 @@
See the 7.x-1.x branch.

View File

@ -0,0 +1,240 @@
<?php
/**
* @file
* commons_events.features.field_base.inc
*/
/**
* Implements hook_field_default_field_bases().
*/
function commons_events_field_default_field_bases() {
$field_bases = array();
// Exported field_base: 'field_date'
$field_bases['field_date'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_date',
'foreign keys' => array(),
'indexes' => array(),
'locked' => 0,
'module' => 'date',
'settings' => array(
'cache_count' => 4,
'cache_enabled' => 0,
'granularity' => array(
'day' => 'day',
'hour' => 'hour',
'minute' => 'minute',
'month' => 'month',
'second' => 0,
'year' => 'year',
),
'timezone_db' => 'UTC',
'todate' => 'required',
'tz_handling' => 'site',
),
'translatable' => 0,
'type' => 'datetime',
);
// Exported field_base: 'field_location'
$field_bases['field_location'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_location',
'foreign keys' => array(),
'indexes' => array(
'value' => array(
0 => 'value',
),
),
'locked' => 0,
'module' => 'list',
'settings' => array(
'allowed_values' => array(
'physical' => 'Physical Address',
'online' => 'Online',
'online_physical' => 'Online and Physical Address',
),
'allowed_values_function' => '',
),
'translatable' => 0,
'type' => 'list_text',
);
// Exported field_base: 'field_logo'
$field_bases['field_logo'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_logo',
'foreign keys' => array(
'fid' => array(
'columns' => array(
'fid' => 'fid',
),
'table' => 'file_managed',
),
),
'indexes' => array(
'fid' => array(
0 => 'fid',
),
),
'locked' => 0,
'module' => 'image',
'settings' => array(
'default_image' => 0,
'uri_scheme' => 'public',
),
'translatable' => 0,
'type' => 'image',
);
// Exported field_base: 'field_number_of_attendees'
$field_bases['field_number_of_attendees'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_number_of_attendees',
'foreign keys' => array(),
'indexes' => array(),
'locked' => 0,
'module' => 'number',
'settings' => array(),
'translatable' => 0,
'type' => 'number_integer',
);
// Exported field_base: 'field_offsite_url'
$field_bases['field_offsite_url'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_offsite_url',
'foreign keys' => array(
'format' => array(
'columns' => array(
'format' => 'format',
),
'table' => 'filter_format',
),
),
'indexes' => array(
'format' => array(
0 => 'format',
),
),
'locked' => 0,
'module' => 'text',
'settings' => array(
'max_length' => 255,
),
'translatable' => 0,
'type' => 'text',
);
// Exported field_base: 'field_organizers'
$field_bases['field_organizers'] = array(
'active' => 1,
'cardinality' => -1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_organizers',
'foreign keys' => array(
'users' => array(
'columns' => array(
'target_id' => 'uid',
),
'table' => 'users',
),
),
'indexes' => array(
'target_id' => array(
0 => 'target_id',
),
),
'locked' => 0,
'module' => 'entityreference',
'settings' => array(
'handler' => 'base',
'handler_settings' => array(
'behaviors' => array(
'views-select-list' => array(
'status' => 0,
),
),
'sort' => array(
'type' => 'none',
),
'target_bundles' => array(),
),
'target_type' => 'user',
),
'translatable' => 0,
'type' => 'entityreference',
);
// Exported field_base: 'field_registration'
$field_bases['field_registration'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_registration',
'foreign keys' => array(
'registration_type' => array(
'columns' => array(
'registration_type' => 'name',
),
'table' => 'registration_type',
),
),
'indexes' => array(
'registration_type' => array(
0 => 'registration_type',
),
),
'locked' => 0,
'module' => 'registration',
'settings' => array(),
'translatable' => 0,
'type' => 'registration',
);
// Exported field_base: 'field_registration_type'
$field_bases['field_registration_type'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_registration_type',
'foreign keys' => array(),
'indexes' => array(
'value' => array(
0 => 'value',
),
),
'locked' => 0,
'module' => 'list',
'settings' => array(
'allowed_values' => array(
'onsite' => 'On this site',
'external' => 'On another site',
),
'allowed_values_function' => '',
),
'translatable' => 0,
'type' => 'list_text',
);
return $field_bases;
}

View File

@ -0,0 +1,736 @@
<?php
/**
* @file
* commons_events.features.field_instance.inc
*/
/**
* Implements hook_field_default_field_instances().
*/
function commons_events_field_default_field_instances() {
$field_instances = array();
// Because the 'site_default_country' variable gets set, but is empty when no
// default country is set, we'll need to do some checks to see if its empty
// and display a default country on our own.
// See https://drupal.org/node/2068957#comment-7773019 for more info.
$default_country = variable_get('site_default_country', 'US');
// Exported field_instance: 'node-event-body'
$field_instances['node-event-body'] = array(
'bundle' => 'event',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 5,
),
'teaser' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(
'trim_length' => 600,
),
'type' => 'text_summary_or_trimmed',
'weight' => 3,
),
),
'entity_type' => 'node',
'field_name' => 'body',
'label' => 'Description',
'required' => 1,
'settings' => array(
'display_summary' => FALSE,
'text_processing' => 1,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'rows' => 20,
'summary_rows' => 5,
),
'type' => 'text_textarea_with_summary',
'weight' => 1,
),
);
// Exported field_instance: 'node-event-field_address'
$field_instances['node-event-field_address'] = array(
'bundle' => 'event',
'default_value' => array(
0 => array(
'element_key' => 'node|event|field_address|und|0',
'thoroughfare' => '',
'premise' => '',
'locality' => '',
'administrative_area' => '',
'postal_code' => '',
'country' => !empty($default_country) ? $default_country : 'US',
),
),
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'addressfield_tokens',
'settings' => array(
'components' => array(
'administrative_area' => 'administrative_area',
'locality' => 'locality',
'postal_code' => 'postal_code',
'thoroughfare' => 'thoroughfare',
),
'separator' => ', ',
),
'type' => 'addressfield_components',
'weight' => 2,
),
'teaser' => array(
'label' => 'hidden',
'module' => 'addressfield_tokens',
'settings' => array(
'components' => array(
'administrative_area' => 'administrative_area',
'locality' => 'locality',
'postal_code' => 'postal_code',
'thoroughfare' => 'thoroughfare',
),
'separator' => ', ',
),
'type' => 'addressfield_components',
'weight' => 2,
),
),
'entity_type' => 'node',
'field_name' => 'field_address',
'label' => 'Address',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'addressfield',
'settings' => array(
'available_countries' => array(),
'format_handlers' => array(
'address' => 'address',
'address-hide-country' => 0,
'organisation' => 0,
'name-full' => 0,
'name-oneline' => 0,
),
),
'type' => 'addressfield_standard',
'weight' => 8,
),
);
// Exported field_instance: 'node-event-field_date'
$field_instances['node-event-field_date'] = array(
'bundle' => 'event',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'date',
'settings' => array(
'format_type' => 'event_datetime',
'fromto' => 'both',
'multiple_from' => '',
'multiple_number' => '',
'multiple_to' => '',
),
'type' => 'date_default',
'weight' => 1,
),
'teaser' => array(
'label' => 'hidden',
'module' => 'date',
'settings' => array(
'format_type' => 'event_datetime',
'fromto' => 'both',
'multiple_from' => '',
'multiple_number' => '',
'multiple_to' => '',
),
'type' => 'date_default',
'weight' => 1,
),
),
'entity_type' => 'node',
'field_name' => 'field_date',
'label' => 'Date',
'required' => 1,
'settings' => array(
'default_value' => 'now',
'default_value2' => 'same',
'default_value_code' => '',
'default_value_code2' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'date',
'settings' => array(
'increment' => 15,
'input_format' => 'm/d/Y - H:i:s',
'input_format_custom' => 'd M Y - h:i:s a',
'label_position' => 'above',
'text_parts' => array(),
'year_range' => '-3:+3',
),
'type' => 'date_popup',
'weight' => 5,
),
);
// Exported field_instance: 'node-event-field_location'
$field_instances['node-event-field_location'] = array(
'bundle' => 'event',
'default_value' => array(
0 => array(
'value' => 'online_physical',
),
),
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 9,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_location',
'label' => 'Location',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_select',
'weight' => 7,
),
);
// Exported field_instance: 'node-event-field_logo'
$field_instances['node-event-field_logo'] = array(
'bundle' => 'event',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'image',
'settings' => array(
'image_link' => '',
'image_style' => '50x50',
),
'type' => 'image',
'weight' => 0,
),
'teaser' => array(
'label' => 'hidden',
'module' => 'image',
'settings' => array(
'image_link' => '',
'image_style' => '50x50',
),
'type' => 'image',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_logo',
'label' => 'Event logo',
'required' => 0,
'settings' => array(
'alt_field' => 0,
'default_image' => 0,
'file_directory' => '',
'file_extensions' => 'png gif jpg jpeg',
'max_filesize' => '2 MB',
'max_resolution' => '',
'min_resolution' => '',
'title_field' => 0,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'image',
'settings' => array(
'preview_image_style' => '50x50',
'progress_indicator' => 'throbber',
),
'type' => 'image_image',
'weight' => 9,
),
);
// Exported field_instance: 'node-event-field_number_of_attendees'
$field_instances['node-event-field_number_of_attendees'] = array(
'bundle' => 'event',
'default_value' => array(
0 => array(
'value' => 0,
),
),
'deleted' => 0,
'description' => 'Enter 0 for unlimited',
'display' => array(
'default' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 8,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_number_of_attendees',
'label' => 'Maximum number of attendees',
'required' => 1,
'settings' => array(
'max' => '',
'min' => 0,
'prefix' => '',
'suffix' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'number',
'settings' => array(),
'type' => 'number',
'weight' => 12,
),
);
// Exported field_instance: 'node-event-field_offsite_url'
$field_instances['node-event-field_offsite_url'] = array(
'bundle' => 'event',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 4,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_offsite_url',
'label' => 'URL',
'required' => 0,
'settings' => array(
'text_processing' => 0,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'size' => 60,
),
'type' => 'text_textfield',
'weight' => 3,
),
);
// Exported field_instance: 'node-event-field_organizers'
$field_instances['node-event-field_organizers'] = array(
'bundle' => 'event',
'default_value' => NULL,
'default_value_function' => '',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'entityreference',
'settings' => array(
'link' => FALSE,
),
'type' => 'hidden',
'weight' => 12,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_organizers',
'label' => 'Organizers',
'required' => 1,
'settings' => array(
'behaviors' => array(
'prepopulate' => array(
'status' => 0,
),
),
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'entityreference',
'settings' => array(
'match_operator' => 'CONTAINS',
'path' => '',
'size' => 60,
),
'type' => 'entityreference_autocomplete_tags',
'weight' => 2,
),
);
// Exported field_instance: 'node-event-field_registration'
$field_instances['node-event-field_registration'] = array(
'bundle' => 'event',
'default_value' => array(
0 => array(
'registration_type' => 'event',
),
),
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 10,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_registration',
'label' => 'Registration bundle',
'required' => 0,
'settings' => array(
'default_registration_settings' => array(
'capacity' => 0,
'reminder' => array(
'reminder_settings' => array(
'reminder_date' => '',
'reminder_template' => '',
),
'send_reminder' => 0,
),
'scheduling' => array(
'close' => '',
'open' => '',
),
'settings' => array(
'from_address' => 'admin@example.com',
'multiple_registrations' => 0,
),
'status' => 1,
),
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 0,
'module' => 'registration',
'settings' => array(),
'type' => 'registration_select',
'weight' => 10,
),
);
// Exported field_instance: 'node-event-field_registration_type'
$field_instances['node-event-field_registration_type'] = array(
'bundle' => 'event',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 11,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'node',
'field_name' => 'field_registration_type',
'label' => 'Registration type',
'required' => 0,
'settings' => array(
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'options',
'settings' => array(),
'type' => 'options_select',
'weight' => 11,
),
);
// Exported field_instance: 'message-commons_events_event_node_created-field_message_rendered_body'
$field_instances['message-commons_events_event_node_created-field_message_rendered_body'] = array(
'bundle' => 'commons_events_event_node_created',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 2,
),
'message_notify_email_body' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 4,
),
'message_notify_email_subject' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 4,
),
),
'entity_type' => 'message',
'field_name' => 'field_message_rendered_body',
'label' => 'Body',
'required' => 0,
'settings' => array(
'text_processing' => 0,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'text',
'settings' => array(
'rows' => 5,
),
'type' => 'text_textarea',
'weight' => 6,
),
);
// Exported field_instance: 'message-commons_events_event_node_created-field_message_rendered_subject'
$field_instances['message-commons_events_event_node_created-field_message_rendered_subject'] = array(
'bundle' => 'commons_events_event_node_created',
'default_value' => NULL,
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'text',
'settings' => array(),
'type' => 'text_default',
'weight' => 3,
),
'message_notify_email_body' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 3,
),
'message_notify_email_subject' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 3,
),
),
'entity_type' => 'message',
'field_name' => 'field_message_rendered_subject',
'label' => 'Subject',
'required' => FALSE,
'settings' => array(
'text_processing' => 0,
'user_register_form' => FALSE,
),
'widget' => array(
'module' => 'text',
'settings' => array(
'size' => 60,
),
'type' => 'text_textfield',
'weight' => 8,
),
);
// Exported field_instance: 'message-commons_events_event_node_created-field_target_comments'
$field_instances['message-commons_events_event_node_created-field_target_comments'] = array(
'bundle' => 'commons_events_event_node_created',
'default_value' => NULL,
'default_value_function' => '',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'entityreference',
'settings' => array(
'link' => FALSE,
),
'type' => 'entityreference_label',
'weight' => 1,
),
'message_notify_email_body' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 5,
),
'message_notify_email_subject' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 5,
),
),
'entity_type' => 'message',
'field_name' => 'field_target_comments',
'label' => 'Target comment',
'required' => 1,
'settings' => array(
'behaviors' => array(
'prepopulate' => array(
'status' => 0,
),
),
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'entityreference',
'settings' => array(
'match_operator' => 'CONTAINS',
'path' => '',
'size' => 60,
),
'type' => 'entityreference_autocomplete',
'weight' => 4,
),
);
// Exported field_instance: 'message-commons_events_event_node_created-field_target_nodes'
$field_instances['message-commons_events_event_node_created-field_target_nodes'] = array(
'bundle' => 'commons_events_event_node_created',
'default_value' => NULL,
'default_value_function' => '',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'entityreference',
'settings' => array(
'link' => FALSE,
),
'type' => 'entityreference_label',
'weight' => 0,
),
'message_notify_email_body' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 6,
),
'message_notify_email_subject' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 6,
),
),
'entity_type' => 'message',
'field_name' => 'field_target_nodes',
'label' => 'Target nodes',
'required' => 0,
'settings' => array(
'behaviors' => array(
'prepopulate' => array(
'status' => 0,
),
),
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'entityreference',
'settings' => array(
'match_operator' => 'CONTAINS',
'path' => '',
'size' => 60,
),
'type' => 'entityreference_autocomplete',
'weight' => 2,
),
);
// Translatables
// Included for use with string extractors like potx.
t('Address');
t('Date');
t('Description');
t('Enter 0 for unlimited');
t('Event logo');
t('Location');
t('Maximum number of attendees');
t('Organizers');
t('Registration bundle');
t('Registration type');
t('URL');
return $field_instances;
}

View File

@ -0,0 +1,178 @@
<?php
/**
* @file
* commons_events.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function commons_events_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "page_manager" && $api == "pages_default") {
return array("version" => "1");
}
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}
/**
* Implements hook_views_api().
*/
function commons_events_views_api($module = NULL, $api = NULL) {
return array("api" => "3.0");
}
/**
* Implements hook_node_info().
*/
function commons_events_node_info() {
$items = array(
'event' => array(
'name' => t('Event'),
'base' => 'node_content',
'description' => t('Post information about planned activities or meetings.'),
'has_title' => '1',
'title_label' => t('Event title'),
'help' => '',
),
);
return $items;
}
/**
* Implements hook_default_registration_type().
*/
function commons_events_default_registration_type() {
$items = array();
$items['event'] = entity_import('registration_type', '{
"name" : "event",
"label" : "Event",
"locked" : "0",
"weight" : "0",
"data" : null,
"rdf_mapping" : []
}');
return $items;
}
/**
* Implements hook_rdf_default_mappings().
*/
function commons_events_rdf_default_mappings() {
$schemaorg = array();
// Exported RDF mapping: event
$schemaorg['node']['event'] = array(
'rdftype' => array(
0 => 'schema:Event',
1 => 'sioc:Item',
2 => 'foaf:Document',
),
'title' => array(
'predicates' => array(
0 => 'schema:name',
),
),
'created' => array(
'predicates' => array(
0 => 'dc:date',
1 => 'dc:created',
),
'datatype' => 'xsd:dateTime',
'callback' => 'date_iso8601',
),
'changed' => array(
'predicates' => array(
0 => 'dc:modified',
),
'datatype' => 'xsd:dateTime',
'callback' => 'date_iso8601',
),
'body' => array(
'predicates' => array(
0 => 'content:encoded',
),
),
'uid' => array(
'predicates' => array(
0 => 'sioc:has_creator',
),
'type' => 'rel',
),
'name' => array(
'predicates' => array(
0 => 'schema:name',
),
),
'comment_count' => array(
'predicates' => array(
0 => 'sioc:num_replies',
),
'datatype' => 'xsd:integer',
),
'last_activity' => array(
'predicates' => array(
0 => 'sioc:last_activity_date',
),
'datatype' => 'xsd:dateTime',
'callback' => 'date_iso8601',
),
'field_date' => array(
'predicates' => array(
0 => 'schema:startDate',
),
),
'url' => array(
'predicates' => array(
0 => 'schema:url',
),
'type' => 'rel',
),
'field_location' => array(
'predicates' => array(),
),
'field_address' => array(
'predicates' => array(
0 => 'schema:location',
),
),
);
return $schemaorg;
}
/**
* Implements hook_default_message_type().
*/
function commons_events_default_message_type() {
$items = array();
$items['commons_events_event_node_created'] = entity_import('message_type', '{
"name" : "commons_events_event_node_created",
"description" : "The notification sent when a user creates an event",
"argument_keys" : [],
"argument" : [],
"category" : "commons_notify",
"data" : {
"token options" : { "clear" : 0 },
"purge" : { "override" : 0, "enabled" : 0, "quota" : "", "days" : "" }
},
"language" : "",
"arguments" : null,
"message_text" : { "und" : [
{
"value" : "New Event on [site:name]: [message:field-target-nodes:0:title_field]",
"format" : "plain_text",
"safe_value" : "\u003Cp\u003ENew Event on [site:name]: [message:field-target-nodes:0:title_field]\u003C\/p\u003E\n"
},
{
"value" : "Hi [message:user:name],\r\n\r\n[message:field-target-nodes:0:author] created the event \u201c[message:field-target-nodes:0:title_field]\u201d on [site:name] [commons-groups:in-groups-text] on [message:field-target-nodes:0:created]:\r\n\r\nWhat: [message:field-target-nodes:0:title_field]\r\nWhen: [message:field-target-nodes:0:field_date]\r\nWhere (If applicable): [message:field-target-nodes:0:field_address]\r\n\r\n[message:field-target-nodes:0:body]\r\n\r\n\r\nPermalink: [message:field-target-nodes:0:url]\r\nAdd a comment at [message:field-target-nodes:0:url]#comment-form\r\n\r\nChange email notifications at [site:url]user\/[message:user:uid]\/notification-settings",
"format" : "plain_text",
"safe_value" : "\u003Cp\u003EHi [message:user:name],\u003C\/p\u003E\n\u003Cp\u003E[message:field-target-nodes:0:author] created the event \u201c[message:field-target-nodes:0:title_field]\u201d on [site:name] [commons-groups:in-groups-text] on [message:field-target-nodes:0:created]:\u003C\/p\u003E\n\u003Cp\u003EWhat: [message:field-target-nodes:0:title_field]\u003Cbr \/\u003E\nWhen: [message:field-target-nodes:0:field_date]\u003Cbr \/\u003E\nWhere (If applicable): [message:field-target-nodes:0:field_address]\u003C\/p\u003E\n\u003Cp\u003E[message:field-target-nodes:0:body]\u003C\/p\u003E\n\u003Cp\u003EPermalink: [message:field-target-nodes:0:url]\u003Cbr \/\u003E\nAdd a comment at [message:field-target-nodes:0:url]#comment-form\u003C\/p\u003E\n\u003Cp\u003EChange email notifications at [site:url]user\/[message:user:uid]\/notification-settings\u003C\/p\u003E\n"
}
]
},
"rdf_mapping" : []
}');
return $items;
}

View File

@ -0,0 +1,37 @@
<?php
/**
* @file
* commons_events.features.menu_links.inc
*/
/**
* Implements hook_menu_default_menu_links().
*/
function commons_events_menu_default_menu_links() {
$menu_links = array();
// Exported menu link: main-menu:events
$menu_links['main-menu:events'] = array(
'menu_name' => 'main-menu',
'link_path' => 'events',
'router_path' => 'events',
'link_title' => 'Events',
'options' => array(
'attributes' => array(),
'identifier' => 'main-menu:events',
),
'module' => 'menu',
'hidden' => 0,
'external' => 0,
'has_children' => 0,
'expanded' => 0,
'weight' => 2,
'customized' => 1,
);
// Translatables
// Included for use with string extractors like potx.
t('Events');
return $menu_links;
}

View File

@ -0,0 +1,52 @@
<?php
/**
* @file
* commons_events.features.og_features_permission.inc
*/
/**
* Implements hook_og_features_default_permissions().
*/
function commons_events_og_features_default_permissions() {
$permissions = array();
// Exported og permission: 'node:group:create event content'
$permissions['node:group:create event content'] = array(
'roles' => array(
'administrator member' => 'administrator member',
'member' => 'member',
),
);
// Exported og permission: 'node:group:delete any event content'
$permissions['node:group:delete any event content'] = array(
'roles' => array(
'administrator member' => 'administrator member',
),
);
// Exported og permission: 'node:group:delete own event content'
$permissions['node:group:delete own event content'] = array(
'roles' => array(
'administrator member' => 'administrator member',
'member' => 'member',
),
);
// Exported og permission: 'node:group:update any event content'
$permissions['node:group:update any event content'] = array(
'roles' => array(
'administrator member' => 'administrator member',
),
);
// Exported og permission: 'node:group:update own event content'
$permissions['node:group:update own event content'] = array(
'roles' => array(
'administrator member' => 'administrator member',
'member' => 'member',
),
);
return $permissions;
}

View File

@ -0,0 +1,94 @@
<?php
/**
* @file
* commons_events.features.user_permission.inc
*/
/**
* Implements hook_user_default_permissions().
*/
function commons_events_user_default_permissions() {
$permissions = array();
// Exported permission: 'create event content'.
$permissions['create event content'] = array(
'name' => 'create event content',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'node',
);
// Exported permission: 'create event registration'.
$permissions['create event registration'] = array(
'name' => 'create event registration',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'registration',
);
// Exported permission: 'delete own event content'.
$permissions['delete own event content'] = array(
'name' => 'delete own event content',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'node',
);
// Exported permission: 'delete own event registration'.
$permissions['delete own event registration'] = array(
'name' => 'delete own event registration',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'registration',
);
// Exported permission: 'edit own event content'.
$permissions['edit own event content'] = array(
'name' => 'edit own event content',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'node',
);
// Exported permission: 'update own event registration'.
$permissions['update own event registration'] = array(
'name' => 'update own event registration',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'registration',
);
// Exported permission: 'view event registration'.
$permissions['view event registration'] = array(
'name' => 'view event registration',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'registration',
);
// Exported permission: 'view own event registration'.
$permissions['view own event registration'] = array(
'name' => 'view own event registration',
'roles' => array(
'administrator' => 'administrator',
'authenticated user' => 'authenticated user',
),
'module' => 'registration',
);
return $permissions;
}

View File

@ -0,0 +1,106 @@
name = Commons Events
description = Provides the Event features for Drupal Commons.
core = 7.x
package = Commons - Content types
dependencies[] = addressfield
dependencies[] = addressfield_tokens
dependencies[] = block
dependencies[] = commons_body
dependencies[] = commons_follow_node
dependencies[] = commons_groups
dependencies[] = commons_notify
dependencies[] = commons_location
dependencies[] = commons_topics
dependencies[] = ctools
dependencies[] = date
dependencies[] = date_api
dependencies[] = date_popup
dependencies[] = date_views
dependencies[] = entity
dependencies[] = entityreference
dependencies[] = features
dependencies[] = field_sql_storage
dependencies[] = image
dependencies[] = list
dependencies[] = menu
dependencies[] = node
dependencies[] = number
dependencies[] = og
dependencies[] = options
dependencies[] = page_manager
dependencies[] = radioactivity
dependencies[] = registration
dependencies[] = registration_views
dependencies[] = strongarm
dependencies[] = taxonomy
dependencies[] = text
dependencies[] = views
dependencies[] = views_content
dependencies[] = views_load_more
features[ctools][] = page_manager:pages_default:1
features[ctools][] = strongarm:strongarm:1
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[field_base][] = field_date
features[field_base][] = field_location
features[field_base][] = field_logo
features[field_base][] = field_number_of_attendees
features[field_base][] = field_offsite_url
features[field_base][] = field_organizers
features[field_base][] = field_registration
features[field_base][] = field_registration_type
features[field_instance][] = node-event-body
features[field_instance][] = node-event-field_address
features[field_instance][] = node-event-field_date
features[field_instance][] = node-event-field_location
features[field_instance][] = node-event-field_logo
features[field_instance][] = node-event-field_number_of_attendees
features[field_instance][] = node-event-field_offsite_url
features[field_instance][] = node-event-field_organizers
features[field_instance][] = node-event-field_registration
features[field_instance][] = node-event-field_registration_type
features[field_instance][] = message-commons_events_event_node_created-field_message_rendered_body
features[field_instance][] = message-commons_events_event_node_created-field_message_rendered_subject
features[field_instance][] = message-commons_events_event_node_created-field_target_nodes
features[menu_links][] = main-menu:events
features[message_type][] = commons_events_event_node_created
features[node][] = event
features[og_features_permission][] = node:group:create event content
features[og_features_permission][] = node:group:delete any event content
features[og_features_permission][] = node:group:delete own event content
features[og_features_permission][] = node:group:update any event content
features[og_features_permission][] = node:group:update own event content
features[page_manager_pages][] = views_events_landing_page
features[registration_type][] = event
features[schemaorg][] = node-event
features[user_permission][] = create event content
features[user_permission][] = create event registration
features[user_permission][] = delete own event content
features[user_permission][] = delete own event registration
features[user_permission][] = edit own event content
features[user_permission][] = update own event registration
features[user_permission][] = view event registration
features[user_permission][] = view own event registration
features[variable][] = comment_anonymous_event
features[variable][] = comment_default_mode_event
features[variable][] = comment_default_per_page_event
features[variable][] = comment_event
features[variable][] = comment_form_location_event
features[variable][] = comment_preview_event
features[variable][] = comment_subject_field_event
features[variable][] = field_bundle_settings_node__event
features[variable][] = menu_options_event
features[variable][] = menu_parent_event
features[variable][] = node_options_event
features[variable][] = node_preview_event
features[variable][] = node_submitted_event
features[views_view][] = commons_events_event_attendee_list
features[views_view][] = commons_events_organizers
features[views_view][] = commons_events_upcoming
features[views_view][] = commons_events_user_upcoming_events
files[] = commons_events.features.inc
files[] = commons_events.features.field_base.inc
files[] = commons_events.features.field_instance.inc
files[] = commons_events.strongarm.inc
files[] = includes/commons_events.forms.inc
files[] = includes/commons_events.theme.inc

View File

@ -0,0 +1,236 @@
<?php
/**
* Implements hook_install().
* Creates a default datetime format for events.
*/
function commons_events_install() {
db_insert('date_formats')
->fields(array(
'format' => 'M d Y, g:ia T',
'type' => 'event_datetime',
'locked' => 1,
))
->execute();
db_insert('date_format_type')
->fields(array(
'type' => 'event_datetime',
'title' => 'Event Datetime',
'locked' => 0,
))
->execute();
variable_set('date_format_event_datetime', 'M d Y, g:ia T');
}
/**
* Disable summary on Event nodes.
*/
function commons_events_update_7000() {
$revert = array(
'commons_events' => array('field_instance'),
);
features_revert($revert);
return array();
}
/**
* Switch attendee view and event logo to use 50x50 image style.
*/
function commons_events_update_7001() {
$revert = array(
'commons_events' => array('views', 'node'),
);
features_revert($revert);
return array();
}
/**
* Add the Organizers entity reference field to Events and update existing nodes
* with the event's creator as the default value.
*/
function commons_events_update_7002() {
// Revert node and views to use default implementations. This resets field
// weights to configuration due to new Organizers field.
$revert = array(
'commons_events' => array('node'),
);
features_revert($revert);
if (field_info_field('field_organizers') == NULL) {
// Create the field so we can update the default values for existing events.
module_load_include('inc', 'commons_events', 'commons_events.features.field_base');
$fields = commons_events_field_default_field_bases();
field_create_field($fields['field_organizers']);
}
if (field_info_instance('node', 'field_organizers', 'event') == NULL) {
// Create the instance on Events.
module_load_include('inc', 'commons_events', 'commons_events.features.field_instance');
$instances = commons_events_field_default_field_instances();
field_create_instance($instances['node-event-field_organizers']);
}
// Now update all existing Events to have the creator as the default organizer.
$events = new EntityFieldQuery();
$events->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'event');
$events = $events->execute();
$events = entity_load('node', array_keys($events['node']));
foreach($events as $nid => $event) {
if (!property_exists($event, 'field_organizers') || empty($event->field_organizers)) {
$event->field_organizers = array(
$event->language => array(
0 => array(
'target_id' => $event->uid
)
),
);
node_save($event);
}
}
return array();
}
/**
* Change event teaser display to show logo, date, and address.
*/
function commons_events_update_7003() {
$revert = array(
'commons_events' => array('field_instance'),
);
features_revert($revert);
return array();
}
/**
* Create the event_datetime date format.
*/
function commons_events_update_7004() {
db_insert('date_formats')
->fields(array(
'format' => 'M d Y - g:ia T',
'type' => 'event_datetime',
'locked' => 1,
))
->execute();
db_insert('date_format_type')
->fields(array(
'type' => 'event_datetime',
'title' => 'Event Datetime',
'locked' => 0,
))
->execute();
variable_set('date_format_event_datetime', 'M d Y - g:ia T');
// Revert commons_events to make sure its referencing the event_datetime module.
$revert = array(
'commons_events' => array('field_instance'),
'commons_events' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Set event nodes to use site default country set during install as default.
*/
function commons_events_update_7005() {
$revert = array(
'commons_events' => array('field_instance'),
);
features_revert($revert);
return array();
}
/**
* Upcoming events view pane exposed sort should redirect to the view pane and
* not the feed.
*/
function commons_events_update_7006() {
$revert = array(
'commons_events' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Change event displays to abbreviate state names.
*/
function commons_events_update_7007() {
$revert = array(
'commons_events' => array('field_instance'),
);
features_revert($revert);
return array();
}
/*
* Alter the event display formatter, it should be a ',' and not '-'
*/
/**
* Create the event_datetime date format.
*/
function commons_events_update_7008() {
db_update('date_formats')
->fields(array(
'format' => 'M d Y, g:ia T',
'type' => 'event_datetime',
'locked' => 1,
))
->condition('format', 'M d Y - g:ia T', '=')
->condition('type', 'event_datetime', '=')
->execute();
variable_set('date_format_event_datetime', 'M d Y, g:ia T');
// Revert commons_events to make sure its referencing the event_datetime module.
$revert = array(
'commons_events' => array('field_instance'),
'commons_events' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Need to force update so that Drupal sees the new hook_forms implementation.
*/
function commons_events_update_7009() {
cache_clear_all('module_implements', 'cache_bootstrap');
return array();
}
/**
* Display current events in addition to upcoming events.
*/
function commons_events_update_7010() {
$revert = array(
'commons_events' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Add empty text to Commons Events views.
*/
function commons_events_update_7011() {
$revert = array(
'commons_events' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Add an event specific message_type feature.
*/
function commons_events_update_7012() {
$revert = array(
'commons_events' => array('message_type', 'field_instance'),
);
features_revert($revert);
return array();
}

View File

@ -0,0 +1,649 @@
<?php
/**
* @file
* Drupal Commons Events feature.
*/
include_once 'commons_events.features.inc';
/**
* Implements hook_forms().
*/
function commons_events_forms($form_id, $args) {
// The attend and cancel event forms need to have a dynamic form ID to allow
// for multiple forms to be shown on the same page and have them work.
foreach (array('commons_events_attend_event_form', 'commons_events_cancel_event_form') as $form) {
if (substr($form_id, 0, strlen($form)) == $form) {
return array(
$form_id => array(
'callback' => $form,
),
);
}
}
}
/**
* Implements hook_menu_alter().
*/
function commons_events_menu_alter(&$items) {
// Hide the "Register" tab since we expose an "Attend" button.
$items['node/%/register']['access callback'] = FALSE;
}
/**
* Access callback for showing the Attendees tab.
*/
function commons_events_attendee_access($event_node) {
if ($event_node->type == 'event') {
return TRUE;
}
return FALSE;
}
/**
* Page callback for full event attendee listing.
*/
function commons_events_event_attendees_page($event_node) {
return theme('commons_events_event_attendees',
array(
'event_nid' => $event_node->nid,
'display' => 'full',
));
}
/**
* Implements hook_theme().
*/
function commons_events_theme($existing, $type, $theme, $path) {
return array(
'commons_events_attending_event' => array(
'variables' => array(
'event' => NULL,
'attendee_count' => NULL,
),
'file' => '/includes/commons_events.theme.inc',
),
'commons_events_event_attendees' => array(
'variables' => array(
'display' => NULL,
'event_nid' => NULL,
),
'file' => '/includes/commons_events.theme.inc',
),
'commons_events_date_display_range_advanced' => array(
'variables' => array(
'date1' => NULL,
'date2' => NULL,
'timezone' => NULL,
'dates' => NULL,
// HTML attributes that will be applied to both the start and end dates
// (unless overridden).
'attributes' => array(),
// HTML attributes that will be applied to the start date only.
'attributes_start' => array(),
// HTML attributes that will be applied to the end date only.
'attributes_end' => array(),
'rdf_mapping' => NULL,
'add_rdf' => NULL,
),
),
'commons_events_date_display_range_simple' => array(
'variables' => array(
'date1' => NULL,
'date2' => NULL,
'timezone' => NULL,
'dates' => NULL,
// HTML attributes that will be applied to both the start and end dates
// (unless overridden).
'attributes' => array(),
// HTML attributes that will be applied to the start date only.
'attributes_start' => array(),
// HTML attributes that will be applied to the end date only.
'attributes_end' => array(),
'rdf_mapping' => NULL,
'add_rdf' => NULL,
),
),
);
}
/**
* Implements hook_theme_registry_alter().
* Gives us the ability to insert our pretty date formatter for the dates we choose below.
*/
function commons_events_theme_registry_alter(&$theme_registry) {
$theme_registry['date_display_range']['theme path'] = drupal_get_path('module', 'commons_events');
$theme_registry['date_display_range']['function'] = 'theme_commons_events_date_display_range_advanced';
$theme_registry['date_display_single']['theme path'] = drupal_get_path('module', 'commons_events');
$theme_registry['date_display_single']['function'] = 'theme_commons_events_date_display_single';
}
/**
* Implements hook_element_info_alter().
*/
function commons_events_element_info_alter(&$type) {
// Extend date_combo processing to alter the label text on the fields.
if (isset($type['date_combo'])) {
$type['date_combo']['#process'][] = 'commons_events_date_combo_element_process';
}
// Extend date_popup processing to remove the redundant descriptions on
// fields.
if (isset($type['date_popup'])) {
$type['date_popup']['#process'][] = 'commons_events_date_popup_element_process';
}
}
/**
* Process date_combo field output.
*
* This is an extension of the Date module's own processing.
*
* @see date_combo_element_process()
* @see commons_events_element_info_alter()
*/
function commons_events_date_combo_element_process($element, &$form_state, $form) {
$field = field_widget_field($element, $form_state);
// Change the labels for from and to dates to something more meaningful.
if (!empty($field['settings']['todate'])) {
$element['value']['#title'] = t('Start date');
$element['value2']['#title'] = t('End date');
}
return $element;
}
/**
* Process date_popup field output.
*
* This is an extension of the Date module's own processing.
*
* @see date_popup_element_process()
* @see commons_events_element_info_alter()
*/
function commons_events_date_popup_element_process($element, &$form_state, $form) {
// If a date_popup field is part of a larger range widget, simplify the
// output.
if (!empty($element['#field']['settings']['todate'])) {
foreach (array('date', 'time') as $type) {
if (!empty($element[$type])) {
// The description and title are unnecessary.
unset($element[$type]['#description']);
$element[$type]['#title'] = '';
}
}
}
return $element;
}
/**
* Implements hook_entity_view_alter().
*/
function commons_events_entity_view_alter(&$build, $type) {
if ($build['#entity_type'] == 'node' && $build['#bundle'] == 'event') {
$build['attending'] = array(
0 => theme('commons_events_attending_event', array(
'event' => $build['#node'],
'attendee_count' => commons_events_get_raw_attendee_count($build['#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']);
}
}
}
/**
* 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',
);
// 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']);
// 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_address']['#states'] = array(
'invisible' => array(
':input[name^="field_location"]' => array('value' => 'online'),
),
);
// Status and attendee limit are shown if registration is onsite.
$node_registration_status = 1;
if (isset($form_state['node']->nid)) {
$settings = registration_entity_settings('node', $form_state['node']->nid);
$node_registration_status = $settings['status'];
}
$form['field_status'] = array(
'#type' => 'select',
'#title' => t('Status'),
'#options' => array(
1 => t('Open to new attendees'),
0 => t('Closed'),
),
'#default_value' => $node_registration_status,
'#states' => array(
'visible' => array(
':input[name^="field_registration_type"]' => array('value' => 'onsite'),
),
),
'#weight' => 10,
);
$form['field_number_of_attendees']['#states'] = $form['field_status']['#states'];
$form['field_registration']['#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.
$form['event_registration_settings'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#title' => t('Registration settings'),
'#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 . ")";
}
$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,
),
),
);
}
/**
* 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']) {
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;
}
break;
}
return TRUE;
}
/**
* Custom node form submit handler.
*/
function commons_events_node_form_submit($form, $form_state) {
$node = $form_state['node'];
$lng = (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') {
$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'];
}
$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(
'entity_type' => 'node',
'entity_id' => $node->nid,
'type' => $registration_type,
));
if (!isset($node->uid)) {
global $user;
$uid = $user->uid;
}
else {
$uid = $node->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),
));
}
}
}
return $replacements;
}
/**
* Generates the 'more' link for upcoming events in a specific group.
*/
function commons_events_upcoming_more_link($group_id) {
if (module_exists('commons_events_solr')) {
$options = array(
'query' => array(
'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);
}
/**
* Implements hook_views_post_execute().
*/
function commons_events_views_post_execute(&$view) {
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>';
}
}
}
/**
* 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,
),
);
return $blocks;
}
/**
* 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'))),
);
}
}
}
/**
* Returns specific HTML for a date element formatted with the event formatter M j Y - g:ia.
*
* We the do some awesome stuff with regular expressions to take all the
* different formats available to us and format it pretty.
*/
function theme_commons_events_date_display_range_simple($variables) {
// Use the regular date formatter if we are any other date format than below.
$date1 = $variables['dates']['value']['formatted_date'];
$date2 = $variables['dates']['value2']['formatted_date'];
$time1 = $variables['dates']['value']['formatted_time'];
$time2 = $variables['dates']['value2']['formatted_time'];
$timezone = $variables['timezone'];
$attributes_start = $variables['attributes_start'];
$attributes_end = $variables['attributes_end'];
if ($date1 == $date2) {
// Wrap the result with the attributes.
return t('!start-time - !end-time', array(
'!start-time' => '<span class="date-display-start"' . drupal_attributes($attributes_start) . '>' . $time1 . '</span>',
'!end-time' => '<span class="date-display-end"' . drupal_attributes($attributes_end) . '>' . $time2 . $timezone . '</span>',
));
}
// Wrap the result with the attributes.
return t('!start-date to !end-date, !start-time - !end-time', array(
'!start-date' => '<span class="date-display-start"' . drupal_attributes($attributes_start) . '>' . $date1 . '</span>',
'!end-date' => '<span class="date-display-end"' . drupal_attributes($attributes_end) . '>' . $date2 . '</span>',
'!start-time' => '<span class="date-display-start"' . drupal_attributes($attributes_start) . '>' . $time1 . '</span>',
'!end-time' => '<span class="date-display-end"' . drupal_attributes($attributes_end) . '>' . $time2 . $timezone . '</span>',
));
}
function theme_commons_events_date_display_single($variables) {
return $variables['date'];
}
/**
* Returns specific HTML for a date element formatted with the event formatter.
*
* We parse the date segments and return it at the bottom, or use the simple
* formatter (above) if parts of the date are too complicated.
*/
function theme_commons_events_date_display_range_advanced($variables) {
$timezone = $variables['timezone'];
$attributes_start = $variables['attributes_start'];
$attributes_end = $variables['attributes_end'];
// Time is always formatted the same.
$time1 = $variables['dates']['value']['formatted_time'];
$time2 = $variables['dates']['value2']['formatted_time'];
// See date.theme line 168 -- regarding formatting time for same date events.
if ($variables['dates']['value']['formatted_date'] === $variables['dates']['value2']['formatted_date']) {
return theme('commons_events_date_display_range_simple', $variables);
}
// If the difference is over a year, use the simple formatter.
if ($variables['dates']['value']['db']['object']->difference($variables['dates']['value2']['db']['object'], 'years') > 0) {
return theme('commons_events_date_display_range_simple', $variables);
}
else {
if ($variables['dates']['value']['db']['object']->difference($variables['dates']['value2']['db']['object'], 'months') > 0) {
$variables['dates']['value']['db']['object']->limitGranularity(array('day', 'month'));
$variables['dates']['value2']['db']['object']->limitGranularity(array('day', 'month', 'year'));
$date1 = $variables['dates']['value']['db']['object']->format($variables['dates']['format'], FALSE);
$date2 = $variables['dates']['value2']['db']['object']->format($variables['dates']['format'], FALSE);
}
else {
if ($variables['dates']['value']['db']['object']->difference($variables['dates']['value2']['db']['object'], 'days') > 0) {
// If the Day is before the month (Europe, etc) then switch the granularity.
if (strpos($variables['dates']['format'], 'M') != 0 || strpos($variables['dates']['format'], 'm') != 0 ||
strpos($variables['dates']['format'], 'F') != 0 || strpos($variables['dates']['format'], 'n') != 0
) {
$variables['dates']['value']['db']['object']->limitGranularity(array('day'));
$variables['dates']['value2']['db']['object']->limitGranularity(array('day', 'month', 'year'));
}
else {
$variables['dates']['value']['db']['object']->limitGranularity(array('month', 'day'));
$variables['dates']['value2']['db']['object']->limitGranularity(array('day', 'year'));
}
$date1 = $variables['dates']['value']['db']['object']->format($variables['dates']['format'], FALSE);
$date2 = $variables['dates']['value2']['db']['object']->format($variables['dates']['format'], FALSE);
// If we are match 'D' or 'l', then we have a 'day' in there (eg Monday),
// we want the whole date because it looks funky otherwise.
if (strpbrk($variables['dates']['format'], 'Dl')) {
return theme('commons_events_date_display_range_simple', $variables);
}
}
else {
return theme('commons_events_date_display_range_simple', $variables);
}
}
}
// Wrap the result with the attributes.
return t('!start-date to !end-date, !start-time - !end-time', array(
'!start-date' => '<span class="date-display-start"' . drupal_attributes($attributes_start) . '>' . $date1 . '</span>',
'!end-date' => '<span class="date-display-end"' . drupal_attributes($attributes_end) . '>' . $date2 . '</span>',
'!start-time' => '<span class="date-display-start"' . drupal_attributes($attributes_start) . '>' . $time1 . '</span>',
'!end-time' => '<span class="date-display-end"' . drupal_attributes($attributes_end) . '>' . $time2 . $timezone . '</span>',
));
}
/**
* Implements commons_notify_message_selection_alter().
*/
function commons_events_commons_notify_message_selection_alter(&$message_type, $hook, $node) {
// Provide a special message type that describes the event details
// when a new event node is created.
if ($hook == 'node_insert' && $node->type == 'event') {
$message_type = 'commons_events_event_node_created';
}
}
/**
* Check whether to allow switching the event's registration type.
* If there are registrations for the event, disallow changing the type. This
* keeps registrations for an event consistent.
*/
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')
->condition('entity_id', $node->nid)
->countQuery()
->execute()
->fetchCol();
if ($registrations[0] > 0) {
return TRUE;
}
return FALSE;
}
/**
* 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')
->condition('entity_id', $node->nid)
->condition('entity_type', 'node')
->countQuery()
->execute()
->fetchField();
return $attendee_count;
}

View File

@ -0,0 +1,193 @@
<?php
/**
* @file
* commons_events.pages_default.inc
*/
/**
* Implements hook_default_page_manager_pages().
*/
function commons_events_default_page_manager_pages() {
$page = new stdClass();
$page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
$page->api_version = 1;
$page->name = 'views_events_landing_page';
$page->task = 'page';
$page->admin_title = 'Views Events Landing Page';
$page->admin_description = '';
$page->path = 'events';
$page->access = array(
'type' => 'none',
'settings' => NULL,
);
$page->menu = array();
$page->arguments = array();
$page->conf = array(
'admin_paths' => FALSE,
);
$page->default_handlers = array();
$handler = new stdClass();
$handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
$handler->api_version = 1;
$handler->name = 'page_views_events_landing_page_panel_context';
$handler->task = 'page';
$handler->subtask = 'views_events_landing_page';
$handler->handler = 'panel_context';
$handler->weight = 0;
$handler->conf = array(
'title' => 'Panel',
'no_blocks' => 0,
'pipeline' => 'ipe',
'body_classes_to_remove' => '',
'body_classes_to_add' => '',
'css_id' => '',
'css' => '',
'contexts' => array(),
'relationships' => array(),
);
$display = new panels_display();
$display->layout = 'two_66_33';
$display->layout_settings = array();
$display->panel_settings = array(
'style_settings' => array(
'default' => NULL,
'two_66_33_top' => NULL,
'two_66_33_first' => NULL,
'two_66_33_second' => NULL,
'two_66_33_bottom' => NULL,
),
);
$display->cache = array();
$display->title = 'Events';
$display->uuid = 'f084cd6c-0d66-7ca4-c971-3c5cf182d2ec';
$display->content = array();
$display->panels = array();
$pane = new stdClass();
$pane->pid = 'new-e72884a7-369b-1954-2d1f-d69207c4d6ff';
$pane->panel = 'two_66_33_first';
$pane->type = 'views_panes';
$pane->subtype = 'commons_events_upcoming-panel_pane_2';
$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 = 'e72884a7-369b-1954-2d1f-d69207c4d6ff';
$display->content['new-e72884a7-369b-1954-2d1f-d69207c4d6ff'] = $pane;
$display->panels['two_66_33_first'][0] = 'new-e72884a7-369b-1954-2d1f-d69207c4d6ff';
$pane = new stdClass();
$pane->pid = 'new-b91ad246-669c-2e14-fd32-5728153b0ed8';
$pane->panel = 'two_66_33_second';
$pane->type = 'block';
$pane->subtype = 'commons_events-commons_events_create_event_link';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'override_title' => 0,
'override_title_text' => '',
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 0;
$pane->locks = array();
$pane->uuid = 'b91ad246-669c-2e14-fd32-5728153b0ed8';
$display->content['new-b91ad246-669c-2e14-fd32-5728153b0ed8'] = $pane;
$display->panels['two_66_33_second'][0] = 'new-b91ad246-669c-2e14-fd32-5728153b0ed8';
$pane = new stdClass();
$pane->pid = 'new-d776b637-24a9-7e74-712c-8bc27d399c3e';
$pane->panel = 'two_66_33_second';
$pane->type = 'block';
$pane->subtype = 'commons_events-commons_events_anonymous_login';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'override_title' => 0,
'override_title_text' => '',
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 1;
$pane->locks = array();
$pane->uuid = 'd776b637-24a9-7e74-712c-8bc27d399c3e';
$display->content['new-d776b637-24a9-7e74-712c-8bc27d399c3e'] = $pane;
$display->panels['two_66_33_second'][1] = 'new-d776b637-24a9-7e74-712c-8bc27d399c3e';
$pane = new stdClass();
$pane->pid = 'new-9118fc7d-3da5-cf54-5152-5d66043812b2';
$pane->panel = 'two_66_33_second';
$pane->type = 'views_panes';
$pane->subtype = 'commons_events_user_upcoming_events-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 = 2;
$pane->locks = array();
$pane->uuid = '9118fc7d-3da5-cf54-5152-5d66043812b2';
$display->content['new-9118fc7d-3da5-cf54-5152-5d66043812b2'] = $pane;
$display->panels['two_66_33_second'][2] = 'new-9118fc7d-3da5-cf54-5152-5d66043812b2';
$pane = new stdClass();
$pane->pid = 'new-ef7caf29-a6a8-e654-5997-6b969eba407a';
$pane->panel = 'two_66_33_second';
$pane->type = 'views_panes';
$pane->subtype = 'commons_events_user_upcoming_events-panel_pane_2';
$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 = 3;
$pane->locks = array();
$pane->uuid = 'ef7caf29-a6a8-e654-5997-6b969eba407a';
$display->content['new-ef7caf29-a6a8-e654-5997-6b969eba407a'] = $pane;
$display->panels['two_66_33_second'][3] = 'new-ef7caf29-a6a8-e654-5997-6b969eba407a';
$pane = new stdClass();
$pane->pid = 'new-80f087dc-fe84-7354-e19b-23e398080db9';
$pane->panel = 'two_66_33_second';
$pane->type = 'views_panes';
$pane->subtype = 'commons_events_user_upcoming_events-panel_pane_3';
$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 = 4;
$pane->locks = array();
$pane->uuid = '80f087dc-fe84-7354-e19b-23e398080db9';
$display->content['new-80f087dc-fe84-7354-e19b-23e398080db9'] = $pane;
$display->panels['two_66_33_second'][4] = 'new-80f087dc-fe84-7354-e19b-23e398080db9';
$display->hide_title = PANELS_TITLE_FIXED;
$display->title_pane = 'new-9118fc7d-3da5-cf54-5152-5d66043812b2';
$handler->conf['display'] = $display;
$page->default_handlers[$handler->name] = $handler;
$pages['views_events_landing_page'] = $page;
return $pages;
}

View File

@ -0,0 +1,147 @@
<?php
/**
* @file
* commons_events.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function commons_events_strongarm() {
$export = array();
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_anonymous_event';
$strongarm->value = 0;
$export['comment_anonymous_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_default_mode_event';
$strongarm->value = 1;
$export['comment_default_mode_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_default_per_page_event';
$strongarm->value = '50';
$export['comment_default_per_page_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_event';
$strongarm->value = '2';
$export['comment_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_form_location_event';
$strongarm->value = 1;
$export['comment_form_location_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_preview_event';
$strongarm->value = '1';
$export['comment_preview_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'comment_subject_field_event';
$strongarm->value = 1;
$export['comment_subject_field_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'field_bundle_settings_node__event';
$strongarm->value = array(
'view_modes' => array(
'teaser' => array(
'custom_settings' => TRUE,
),
'full' => array(
'custom_settings' => FALSE,
),
'rss' => array(
'custom_settings' => FALSE,
),
'search_index' => array(
'custom_settings' => FALSE,
),
'search_result' => array(
'custom_settings' => FALSE,
),
'token' => array(
'custom_settings' => FALSE,
),
),
'extra_fields' => array(
'form' => array(
'title' => array(
'weight' => '0',
),
'metatags' => array(
'weight' => '15',
),
'path' => array(
'weight' => '14',
),
'redirect' => array(
'weight' => '13',
),
),
'display' => array(),
),
);
$export['field_bundle_settings_node__event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'menu_options_event';
$strongarm->value = array(
0 => 'main-menu',
);
$export['menu_options_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'menu_parent_event';
$strongarm->value = 'main-menu:0';
$export['menu_parent_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'node_options_event';
$strongarm->value = array(
0 => 'status',
);
$export['node_options_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'node_preview_event';
$strongarm->value = '1';
$export['node_preview_event'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'node_submitted_event';
$strongarm->value = 1;
$export['node_submitted_event'] = $strongarm;
return $export;
}

View File

@ -0,0 +1,791 @@
<?php
/**
* @file
* commons_events.views_default.inc
*/
/**
* Implements hook_views_default_views().
*/
function commons_events_views_default_views() {
$export = array();
$view = new view();
$view->name = 'commons_events_event_attendee_list';
$view->description = 'List attendees for a given event.';
$view->tag = 'commons_events';
$view->base_table = 'registration';
$view->human_name = 'Commons Events - Event Attendee List';
$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'] = 'Attendees';
$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'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '20';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '4';
$handler->display->display_options['style_plugin'] = 'grid';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relationship: Registration: Registration to Node */
$handler->display->display_options['relationships']['registration_related_node']['id'] = 'registration_related_node';
$handler->display->display_options['relationships']['registration_related_node']['table'] = 'registration';
$handler->display->display_options['relationships']['registration_related_node']['field'] = 'registration_related_node';
/* Relationship: Registration: User */
$handler->display->display_options['relationships']['user_uid']['id'] = 'user_uid';
$handler->display->display_options['relationships']['user_uid']['table'] = 'registration';
$handler->display->display_options['relationships']['user_uid']['field'] = 'user_uid';
$handler->display->display_options['relationships']['user_uid']['required'] = TRUE;
/* 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'] = 'user_uid';
$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';
/* 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'] = 'user_uid';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['element_label_colon'] = FALSE;
/* Contextual filter: Content: Nid */
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['relationship'] = 'registration_related_node';
$handler->display->display_options['arguments']['nid']['default_action'] = 'empty';
$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
/* Display: Full Attendee List Block */
$handler = $view->new_display('block', 'Full Attendee List Block', 'commons_events_full_attendee_list');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
/* Display: Content pane */
$handler = $view->new_display('panel_pane', 'Content pane', 'panel_pane_1');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['allow']['use_pager'] = 'use_pager';
$handler->display->display_options['allow']['items_per_page'] = 'items_per_page';
$handler->display->display_options['allow']['offset'] = 'offset';
$handler->display->display_options['allow']['link_to_view'] = 0;
$handler->display->display_options['allow']['more_link'] = 0;
$handler->display->display_options['allow']['path_override'] = 0;
$handler->display->display_options['allow']['title_override'] = 0;
$handler->display->display_options['allow']['exposed_form'] = 0;
$handler->display->display_options['allow']['fields_override'] = 0;
$handler->display->display_options['argument_input'] = array(
'null' => array(
'type' => 'fixed',
'context' => 'entity:comment.author',
'context_optional' => 0,
'panel' => '0',
'fixed' => 'node',
'label' => 'Global: Null',
),
'nid' => array(
'type' => 'context',
'context' => 'entity:node.nid',
'context_optional' => 0,
'panel' => '0',
'fixed' => '',
'label' => 'Content: Nid',
),
);
$translatables['commons_events_event_attendee_list'] = array(
t('Master'),
t('Attendees'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Items per page'),
t('- All -'),
t('Offset'),
t('« first'),
t(' previous'),
t('next '),
t('last »'),
t('node from Registration'),
t('User'),
t('All'),
t('Full Attendee List Block'),
t('Content pane'),
t('View panes'),
);
$export['commons_events_event_attendee_list'] = $view;
$view = new view();
$view->name = 'commons_events_organizers';
$view->description = 'Event organizer panel pane.';
$view->tag = 'commons_events';
$view->base_table = 'node';
$view->human_name = 'Commons Events - Organizers';
$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'] = 'Organizers';
$handler->display->display_options['use_more_always'] = FALSE;
$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['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'grid';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relationship: Entity Reference: Referenced Entity */
$handler->display->display_options['relationships']['field_organizers_target_id']['id'] = 'field_organizers_target_id';
$handler->display->display_options['relationships']['field_organizers_target_id']['table'] = 'field_data_field_organizers';
$handler->display->display_options['relationships']['field_organizers_target_id']['field'] = 'field_organizers_target_id';
$handler->display->display_options['relationships']['field_organizers_target_id']['required'] = TRUE;
/* 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'] = 'field_organizers_target_id';
$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';
/* Contextual filter: Content: Nid */
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['default_action'] = 'not found';
$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['nid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['nid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['summary_options']['items_per_page'] = '25';
/* Display: Content pane */
$handler = $view->new_display('panel_pane', 'Content pane', 'panel_pane_1');
$handler->display->display_options['argument_input'] = array(
'nid' => array(
'type' => 'context',
'context' => 'entity:node.nid',
'context_optional' => 0,
'panel' => '0',
'fixed' => '',
'label' => 'Content: Nid',
),
);
$translatables['commons_events_organizers'] = array(
t('Master'),
t('Organizers'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('User entity referenced from field_organizers'),
t('All'),
t('Content pane'),
t('View panes'),
);
$export['commons_events_organizers'] = $view;
$view = new view();
$view->name = 'commons_events_upcoming';
$view->description = 'Display upcoming events site-wide, or per-group.';
$view->tag = 'commons_events';
$view->base_table = 'node';
$view->human_name = 'Commons Events - Upcoming Events';
$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'] = 'Events';
$handler->display->display_options['use_more_always'] = FALSE;
$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['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'load_more';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$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;
/* 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';
$handler->display->display_options['fields']['field_date']['field'] = 'field_date';
$handler->display->display_options['fields']['field_date']['label'] = '';
$handler->display->display_options['fields']['field_date']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_date']['settings'] = array(
'format_type' => 'event_datetime',
'fromto' => 'both',
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
);
/* Field: Registration Settings: Spaces used */
$handler->display->display_options['fields']['capacity_used']['id'] = 'capacity_used';
$handler->display->display_options['fields']['capacity_used']['table'] = 'node';
$handler->display->display_options['fields']['capacity_used']['field'] = 'capacity_used';
$handler->display->display_options['fields']['capacity_used']['label'] = '';
$handler->display->display_options['fields']['capacity_used']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['capacity_used']['separator'] = '';
$handler->display->display_options['fields']['capacity_used']['suffix'] = ' attendees';
/* Field: Content: Comment count */
$handler->display->display_options['fields']['comment_count']['id'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['table'] = 'node_comment_statistics';
$handler->display->display_options['fields']['comment_count']['field'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['label'] = '';
$handler->display->display_options['fields']['comment_count']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['comment_count']['alter']['text'] = '[comment_count] comments';
$handler->display->display_options['fields']['comment_count']['element_label_colon'] = FALSE;
/* Sort criterion: Content: Date - start date (field_date) */
$handler->display->display_options['sorts']['field_date_value']['id'] = 'field_date_value';
$handler->display->display_options['sorts']['field_date_value']['table'] = 'field_data_field_date';
$handler->display->display_options['sorts']['field_date_value']['field'] = 'field_date_value';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$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: Content: Type */
$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(
'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: Feed */
$handler = $view->new_display('feed', 'Feed', 'feed');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['style_plugin'] = 'rss';
$handler->display->display_options['row_plugin'] = 'node_rss';
$handler->display->display_options['path'] = 'events-upcoming.xml';
$handler->display->display_options['displays'] = array(
'default' => 'default',
'page' => 'page',
);
/* Display: Global Block */
$handler = $view->new_display('block', 'Global Block', 'commons_events_upcoming_global_block');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = 'Upcoming events';
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'default';
$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['defaults']['row_options'] = FALSE;
/* Display: Group pane */
$handler = $view->new_display('panel_pane', 'Group pane', 'panel_pane_1');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = 'Upcoming events';
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'load_more';
$handler->display->display_options['pager']['options']['items_per_page'] = '3';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['quantity'] = '9';
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'default';
$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']['inline'] = array(
'capacity_used' => 'capacity_used',
'comment_count' => 'comment_count',
);
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['relationships'] = FALSE;
/* Relationship: OG membership: OG membership from Node */
$handler->display->display_options['relationships']['og_membership_rel']['id'] = 'og_membership_rel';
$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;
$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;
/* 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';
$handler->display->display_options['fields']['field_date']['field'] = 'field_date';
$handler->display->display_options['fields']['field_date']['label'] = '';
$handler->display->display_options['fields']['field_date']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_date']['settings'] = array(
'format_type' => 'event_datetime',
'fromto' => 'both',
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
);
/* Field: Registration Settings: Spaces used */
$handler->display->display_options['fields']['capacity_used']['id'] = 'capacity_used';
$handler->display->display_options['fields']['capacity_used']['table'] = 'node';
$handler->display->display_options['fields']['capacity_used']['field'] = 'capacity_used';
$handler->display->display_options['fields']['capacity_used']['label'] = '';
$handler->display->display_options['fields']['capacity_used']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['capacity_used']['separator'] = '';
$handler->display->display_options['fields']['capacity_used']['suffix'] = ' attendees,';
/* Field: Content: Comment count */
$handler->display->display_options['fields']['comment_count']['id'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['table'] = 'node_comment_statistics';
$handler->display->display_options['fields']['comment_count']['field'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['label'] = '';
$handler->display->display_options['fields']['comment_count']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['comment_count']['alter']['text'] = '[comment_count] comments';
$handler->display->display_options['fields']['comment_count']['element_label_colon'] = FALSE;
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: OG membership: Group ID */
$handler->display->display_options['arguments']['gid']['id'] = 'gid';
$handler->display->display_options['arguments']['gid']['table'] = 'og_membership';
$handler->display->display_options['arguments']['gid']['field'] = 'gid';
$handler->display->display_options['arguments']['gid']['relationship'] = 'og_membership_rel';
$handler->display->display_options['arguments']['gid']['default_action'] = 'empty';
$handler->display->display_options['arguments']['gid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['gid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['gid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['gid']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['pane_category']['name'] = 'Commons';
$handler->display->display_options['pane_category']['weight'] = '0';
$handler->display->display_options['argument_input'] = array(
'gid' => array(
'type' => 'context',
'context' => 'entity:node.nid',
'context_optional' => 0,
'panel' => '0',
'fixed' => '',
'label' => 'OG membership: Group ID',
),
);
/* Display: Landing Page pane */
$handler = $view->new_display('panel_pane', 'Landing Page pane', 'panel_pane_2');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['exposed_form'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['expose_sort_order'] = FALSE;
$handler->display->display_options['exposed_form']['options']['autosubmit'] = TRUE;
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['defaults']['style_options'] = FALSE;
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
$handler->display->display_options['row_plugin'] = 'node';
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['header'] = FALSE;
$handler->display->display_options['defaults']['empty'] = 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';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = 'No events have been created yet.';
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
$handler->display->display_options['defaults']['sorts'] = FALSE;
/* Sort criterion: Content: Promoted to front page */
$handler->display->display_options['sorts']['promote']['id'] = 'promote';
$handler->display->display_options['sorts']['promote']['table'] = 'node';
$handler->display->display_options['sorts']['promote']['field'] = 'promote';
$handler->display->display_options['sorts']['promote']['exposed'] = TRUE;
$handler->display->display_options['sorts']['promote']['expose']['label'] = 'Featured';
/* Sort criterion: Content: Date - start date (field_date) */
$handler->display->display_options['sorts']['field_date_value']['id'] = 'field_date_value';
$handler->display->display_options['sorts']['field_date_value']['table'] = 'field_data_field_date';
$handler->display->display_options['sorts']['field_date_value']['field'] = 'field_date_value';
$handler->display->display_options['sorts']['field_date_value']['exposed'] = TRUE;
$handler->display->display_options['sorts']['field_date_value']['expose']['label'] = 'Date';
$handler->display->display_options['inherit_panels_path'] = '1';
$translatables['commons_events_upcoming'] = array(
t('Master'),
t('Events'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Items per page'),
t('- All -'),
t('Offset'),
t('« first'),
t(' previous'),
t('next '),
t('last »'),
t('.'),
t(' attendees'),
t('[comment_count] comments'),
t(','),
t('Feed'),
t('Global Block'),
t('Upcoming events'),
t('Group pane'),
t('OG membership from node'),
t(' attendees,'),
t('All'),
t('Commons'),
t('Landing Page pane'),
t('No events have been created yet.'),
t('Featured'),
t('Date'),
t('View panes'),
);
$export['commons_events_upcoming'] = $view;
$view = new view();
$view->name = 'commons_events_user_upcoming_events';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Commons Events - User Upcoming Events';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'role';
$handler->display->display_options['access']['role'] = array(
2 => '2',
);
$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'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '2';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* 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';
$handler->display->display_options['empty']['area']['empty'] = TRUE;
$handler->display->display_options['empty']['area']['content'] = 'You are not attending any upcoming events.';
$handler->display->display_options['empty']['area']['format'] = 'filtered_html';
/* Relationship: Registration: Node to Registration */
$handler->display->display_options['relationships']['registration_rel']['id'] = 'registration_rel';
$handler->display->display_options['relationships']['registration_rel']['table'] = 'node';
$handler->display->display_options['relationships']['registration_rel']['field'] = 'registration_rel';
$handler->display->display_options['relationships']['registration_rel']['required'] = TRUE;
/* Relationship: Registration: User */
$handler->display->display_options['relationships']['user_uid']['id'] = 'user_uid';
$handler->display->display_options['relationships']['user_uid']['table'] = 'registration';
$handler->display->display_options['relationships']['user_uid']['field'] = 'user_uid';
$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['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Contextual filter: Registration: User */
$handler->display->display_options['arguments']['user_uid']['id'] = 'user_uid';
$handler->display->display_options['arguments']['user_uid']['table'] = 'registration';
$handler->display->display_options['arguments']['user_uid']['field'] = 'user_uid';
$handler->display->display_options['arguments']['user_uid']['relationship'] = 'registration_rel';
$handler->display->display_options['arguments']['user_uid']['default_action'] = 'empty';
$handler->display->display_options['arguments']['user_uid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['user_uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['user_uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['user_uid']['summary_options']['items_per_page'] = '25';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$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: Content: Type */
$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(
'event' => 'event',
);
/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
/* Display: You're attending - pane */
$handler = $view->new_display('panel_pane', 'You\'re attending - pane', 'panel_pane_1');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = 'You\'re attending';
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'default';
$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']['inline'] = array(
'capacity_used' => 'capacity_used',
'comment_count' => 'comment_count',
);
$handler->display->display_options['defaults']['row_options'] = FALSE;
$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;
/* 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';
$handler->display->display_options['fields']['field_address']['field'] = 'field_address';
$handler->display->display_options['fields']['field_address']['label'] = '';
$handler->display->display_options['fields']['field_address']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_address']['click_sort_column'] = 'country';
$handler->display->display_options['fields']['field_address']['settings'] = array(
'use_widget_handlers' => 1,
'format_handlers' => array(
'address' => 'address',
),
);
/* Field: Registration Settings: Spaces used */
$handler->display->display_options['fields']['capacity_used']['id'] = 'capacity_used';
$handler->display->display_options['fields']['capacity_used']['table'] = 'node';
$handler->display->display_options['fields']['capacity_used']['field'] = 'capacity_used';
$handler->display->display_options['fields']['capacity_used']['label'] = '';
$handler->display->display_options['fields']['capacity_used']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['capacity_used']['alter']['text'] = '<strong>[capacity_used]</strong> attendees,';
$handler->display->display_options['fields']['capacity_used']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['capacity_used']['separator'] = '';
/* Field: Content: Comment count */
$handler->display->display_options['fields']['comment_count']['id'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['table'] = 'node_comment_statistics';
$handler->display->display_options['fields']['comment_count']['field'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['label'] = '';
$handler->display->display_options['fields']['comment_count']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['comment_count']['alter']['text'] = '<strong>[comment_count]</strong> comments';
$handler->display->display_options['fields']['comment_count']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['comment_count']['separator'] = '';
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: Registration: User */
$handler->display->display_options['arguments']['user_uid']['id'] = 'user_uid';
$handler->display->display_options['arguments']['user_uid']['table'] = 'registration';
$handler->display->display_options['arguments']['user_uid']['field'] = 'user_uid';
$handler->display->display_options['arguments']['user_uid']['relationship'] = 'registration_rel';
$handler->display->display_options['arguments']['user_uid']['default_action'] = 'default';
$handler->display->display_options['arguments']['user_uid']['default_argument_type'] = 'current_user';
$handler->display->display_options['arguments']['user_uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['user_uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['user_uid']['summary_options']['items_per_page'] = '25';
/* Display: You created - pane */
$handler = $view->new_display('panel_pane', 'You created - pane', 'panel_pane_2');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = 'You created';
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'default';
$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']['inline'] = array(
'capacity_used' => 'capacity_used',
'comment_count' => 'comment_count',
);
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['empty'] = FALSE;
$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;
/* 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';
$handler->display->display_options['fields']['field_address']['field'] = 'field_address';
$handler->display->display_options['fields']['field_address']['label'] = '';
$handler->display->display_options['fields']['field_address']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_address']['click_sort_column'] = 'country';
$handler->display->display_options['fields']['field_address']['settings'] = array(
'use_widget_handlers' => 1,
'format_handlers' => array(
'address' => 'address',
),
);
/* Field: Registration Settings: Spaces used */
$handler->display->display_options['fields']['capacity_used']['id'] = 'capacity_used';
$handler->display->display_options['fields']['capacity_used']['table'] = 'node';
$handler->display->display_options['fields']['capacity_used']['field'] = 'capacity_used';
$handler->display->display_options['fields']['capacity_used']['label'] = '';
$handler->display->display_options['fields']['capacity_used']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['capacity_used']['alter']['text'] = '<strong>[capacity_used]</strong> attendees,';
$handler->display->display_options['fields']['capacity_used']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['capacity_used']['separator'] = '';
/* Field: Content: Comment count */
$handler->display->display_options['fields']['comment_count']['id'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['table'] = 'node_comment_statistics';
$handler->display->display_options['fields']['comment_count']['field'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['label'] = '';
$handler->display->display_options['fields']['comment_count']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['comment_count']['alter']['text'] = '<strong>[comment_count]</strong> comments';
$handler->display->display_options['fields']['comment_count']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['comment_count']['separator'] = '';
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Contextual filter: Content: Author uid */
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
$handler->display->display_options['arguments']['uid']['table'] = 'node';
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
$handler->display->display_options['arguments']['uid']['default_action'] = 'default';
$handler->display->display_options['arguments']['uid']['default_argument_type'] = 'current_user';
$handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
/* Display: You follow - pane */
$handler = $view->new_display('panel_pane', 'You follow - pane', 'panel_pane_3');
$handler->display->display_options['defaults']['title'] = FALSE;
$handler->display->display_options['title'] = 'You follow';
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'default';
$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']['inline'] = array(
'capacity_used' => 'capacity_used',
'comment_count' => 'comment_count',
);
$handler->display->display_options['defaults']['row_options'] = FALSE;
$handler->display->display_options['defaults']['empty'] = FALSE;
$handler->display->display_options['defaults']['relationships'] = FALSE;
/* 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']['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;
/* 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';
$handler->display->display_options['fields']['field_address']['field'] = 'field_address';
$handler->display->display_options['fields']['field_address']['label'] = '';
$handler->display->display_options['fields']['field_address']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_address']['click_sort_column'] = 'country';
$handler->display->display_options['fields']['field_address']['settings'] = array(
'use_widget_handlers' => 1,
'format_handlers' => array(
'address' => 'address',
),
);
/* Field: Registration Settings: Spaces used */
$handler->display->display_options['fields']['capacity_used']['id'] = 'capacity_used';
$handler->display->display_options['fields']['capacity_used']['table'] = 'node';
$handler->display->display_options['fields']['capacity_used']['field'] = 'capacity_used';
$handler->display->display_options['fields']['capacity_used']['label'] = '';
$handler->display->display_options['fields']['capacity_used']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['capacity_used']['alter']['text'] = '<strong>[capacity_used]</strong> attendees,';
$handler->display->display_options['fields']['capacity_used']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['capacity_used']['separator'] = '';
/* Field: Content: Comment count */
$handler->display->display_options['fields']['comment_count']['id'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['table'] = 'node_comment_statistics';
$handler->display->display_options['fields']['comment_count']['field'] = 'comment_count';
$handler->display->display_options['fields']['comment_count']['label'] = '';
$handler->display->display_options['fields']['comment_count']['alter']['alter_text'] = TRUE;
$handler->display->display_options['fields']['comment_count']['alter']['text'] = '<strong>[comment_count]</strong> comments';
$handler->display->display_options['fields']['comment_count']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['comment_count']['separator'] = '';
$handler->display->display_options['defaults']['arguments'] = FALSE;
$translatables['commons_events_user_upcoming_events'] = array(
t('Master'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('You are not attending any upcoming events.'),
t('node being the Registration'),
t('User'),
t('All'),
t('Block'),
t('You\'re attending - pane'),
t('You\'re attending'),
t('<strong>[capacity_used]</strong> attendees,'),
t('.'),
t('<strong>[comment_count]</strong> comments'),
t('View panes'),
t('You created - pane'),
t('You created'),
t('You follow - pane'),
t('You follow'),
t('flag'),
);
$export['commons_events_user_upcoming_events'] = $view;
return $export;
}

View File

@ -0,0 +1,42 @@
#edit-events-sidebar legend .summary {
width: 25em;
overflow: hidden;
line-height: 1em;
height: 1em;
}
#edit-events-sidebar .fieldset-legend .fieldset-title {
display: block;
}
#legend-registration-type:after {
content: ', ';
}
.view-commons-events-event-attendee-list {
background-color: #fff;
}
/**
* Fix fieldset margins for date and address field since they have weird
* spacing issues.
*/
#edit-field-date .fieldset-description {
display: none;
}
#edit-field-date .date-padding {
padding: 0px;
}
#edit-field-date .fieldset-wrapper .form-item:first-child,
#edit-field-date .form-item .form-item,
#edit-field-address .fieldset-wrapper .form-item:first-child,
#edit-field-address .form-item {
margin-top: 0em;
}
form.commons-events-form-float {
float: right;
}
.commons-events-button {
margin-left: 5px;
}

View File

@ -0,0 +1,121 @@
<?php
/**
* @file
* Commons Events form declarations.
*/
/**
* Form builder for Attend call to action on events, as long as registration
* is available onsite.
*/
function commons_events_attend_event_form($form, &$form_state, $event_node, $registration = NULL, $attendee_count = 0) {
$form_state['event_node'] = $event_node;
if (!registration_status('node', $event_node->nid, TRUE)) {
return array();
}
if (!isset($registration)) {
$registration_type = registration_get_entity_registration_type('node', $event_node);
$registration = entity_get_controller('registration')->create(array(
'entity_type' => 'node',
'entity_id' => $event_node->nid,
'type' => $registration_type,
));
}
$form_state['registration'] = $registration;
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Attend'),
);
$form['attending'] = array(
'#theme_wrappers' => array('container'),
'#attributes' => array(
'class' => array('commons-event-status'),
),
'#markup' => format_plural($attendee_count, '<span class="commons-event-count">1</span> attendee', '<span class="commons-event-count">@count</span> attendees'),
);
$form['#attached']['css'] = array(
drupal_get_path('module', 'commons_events') . '/css/commons_events.css',
);
$form['#attributes'] = array('class' => array('commons-events-form-float'));
return $form;
}
/**
* Validation handler for attending an event.
* Checks to make sure that space is available for attending, and that it
* didn't fill up after the page load.
*/
function commons_events_attend_event_form_validate($form, &$form_state) {
global $user;
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)) {
form_set_error('submit', t('You are already registered for this event.'));
return FALSE;
}
return TRUE;
}
/**
* Submission handler for attending an event.
*/
function commons_events_attend_event_form_submit($form, $form_state) {
global $user;
$registration = $form_state['registration'];
$registration->user_uid = $user->uid;
$registration->author_uid = $user->uid;
$registration->state = NULL;
$registration->count = 1;
if (registration_save($registration)) {
drupal_set_message(t('Your registration was saved.'));
commons_follow_node_follow_node($registration->entity_id, 'event', $user->uid);
}
else {
drupal_set_message(t('There was an error saving your registration.'));
}
}
/**
* Form to cancel a registration for an event.
*/
function commons_events_cancel_event_form($form, &$form_state, $event) {
$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['submit'] = array(
'#type' => 'submit',
'#value' => t('Cancel'),
);
$form['submit']['#attributes']['class'][] = 'commons-events-button';
$form['attending'] = array(
'#theme_wrappers' => array('container'),
'#attributes' => array(
'class' => array('commons-event-status'),
),
'#markup' => t('You are attending.'),
);
return $form;
}
/**
* 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']));
drupal_set_message(t('Your registration has been cancelled.'));
}
}

View File

@ -0,0 +1,55 @@
<?php
/**
* @file
* Commons Events theme functions.
*/
/**
* Theme callback to display that a user is attending an event.
*/
function theme_commons_events_attending_event($variables = array()) {
global $user;
$event = $variables['event'];
$attendee_count = isset($variables['attendee_count']) ? $variables['attendee_count'] : 0;
$registration_type = registration_get_entity_registration_type('node', $event);
$registration = entity_get_controller('registration')->create(array(
'entity_type' => 'node',
'entity_id' => $event->nid,
'type' => $registration_type,
'author_uid' => $user->uid,
));
if (!function_exists('commons_events_attend_event_form')
|| !function_exists('commons_events_cancel_event_form')) {
module_load_include('inc', 'commons_events', 'includes/commons_events.forms');
}
if (!registration_is_registered($registration, NULL, $user->uid)
&& registration_access('create', $registration, $user, $registration->type)
&& 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) &&
registration_access('delete', $registration, $user, $registration->type)) {
return drupal_get_form('commons_events_cancel_event_form_' . $event->nid, $event);
}
return "";
}
/**
* Theme the event attendees list.
*/
function theme_commons_events_event_attendees($variables = array()) {
$title = '<p class="commons-events-attendees-title">' . t('Attendees') . '</p>';
$event_nid = $variables['event_nid'];
if (!isset($variables['display'])
|| $variables['display'] != 'full') {
return $title . views_embed_view('commons_events_event_attendee_list', 'default', $event_nid)
. '<p class="commons-events-all-attendees"><a href="/node/' . $event_nid . '/attendees">'
. t('See all attendees') . '</a></p>';
}
return $title . views_embed_view(
'commons_events_event_attendee_list',
'commons_events_full_attendee_list',
$event_nid);
}

View File

@ -0,0 +1,18 @@
(function ($) {
Drupal.behaviors.commons_events_update_registration_settings_legend = {
attach: function (context, settings) {
$(':input[name^="field_registration_type"]').change(function() {
$("[id^='edit-event-registration-settings'] .summary").text($(':input[name^="field_registration_type"] :selected').text());
if ($(':input[name^="field_registration_type"]').val() == 'external') {
$(':input[name^="field_status"]').val('0').change();
}
});
$(':input[name^="field_status"]').change(function() {
var cur = $(':input[name^="field_registration_type"] :selected').text();
$("[id^='edit-event-registration-settings'] .summary").text(cur + ', ' + $(':input[name="field_status"] :selected').text());
});
$(':input[name^="field_registration_type"]').change();
$(':input[name^="field_status"]').change();
}
};
})(jQuery);

View File

@ -0,0 +1,17 @@
<?php
/**
* @file
* commons_events_pages.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function commons_events_pages_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "panelizer" && $api == "panelizer") {
return array("version" => "1");
}
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}

View File

@ -0,0 +1,14 @@
name = Commons Events Pages
description = Provides the panelized Event page feature.
core = 7.x
package = Commons - Landing pages
dependencies[] = commons_events
dependencies[] = panelizer
dependencies[] = strongarm
features[ctools][] = panelizer:panelizer:1
features[ctools][] = strongarm:strongarm:1
features[features_api][] = api:2
features[panelizer_defaults][] = node:event:default
features[variable][] = panelizer_defaults_node_event
files[] = commons_events_pages.features.inc
files[] = commons_events_pages.strongarm.inc

View File

@ -0,0 +1,9 @@
<?php
/**
* Add page title.
*/
function commons_events_pages_update_7301() {
features_revert(array('commons_events_pages' => array('page_manager_pages')));
return array();
}

View File

@ -0,0 +1,7 @@
<?php
/**
* @file
* Commons Events Pages module.
*/
include_once 'commons_events_pages.features.inc';

View File

@ -0,0 +1,134 @@
<?php
/**
* @file
* commons_events_pages.panelizer.inc
*/
/**
* Implements hook_panelizer_defaults().
*/
function commons_events_pages_panelizer_defaults() {
$export = array();
$panelizer = new stdClass();
$panelizer->disabled = FALSE; /* Edit this to true to make a default panelizer disabled initially */
$panelizer->api_version = 1;
$panelizer->name = 'node:event:default';
$panelizer->title = 'Default';
$panelizer->panelizer_type = 'node';
$panelizer->panelizer_key = 'event';
$panelizer->no_blocks = FALSE;
$panelizer->css_id = '';
$panelizer->css = '';
$panelizer->pipeline = 'ipe';
$panelizer->contexts = array();
$panelizer->relationships = array();
$panelizer->access = array();
$panelizer->view_mode = 'page_manager';
$panelizer->css_class = '';
$panelizer->title_element = 'H2';
$panelizer->link_to_entity = TRUE;
$panelizer->extra = array();
$display = new panels_display();
$display->layout = 'two_66_33';
$display->layout_settings = array();
$display->panel_settings = array(
'style_settings' => array(
'default' => NULL,
'two_66_33_top' => NULL,
'two_66_33_first' => NULL,
'two_66_33_second' => NULL,
'two_66_33_bottom' => NULL,
),
);
$display->cache = array();
$display->title = '%node:title';
$display->uuid = '0d63be4d-5605-1644-fd5c-3872c8b1d8b6';
$display->content = array();
$display->panels = array();
$pane = new stdClass();
$pane->pid = 'new-f259289a-8ef0-6aa4-2592-c59928474958';
$pane->panel = 'two_66_33_first';
$pane->type = 'node_content';
$pane->subtype = 'node_content';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'links' => 1,
'no_extras' => 0,
'override_title' => 0,
'override_title_text' => '',
'identifier' => '',
'link' => 0,
'leave_node_title' => 1,
'build_mode' => 'full',
'context' => 'panelizer',
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 0;
$pane->locks = array();
$pane->uuid = 'f259289a-8ef0-6aa4-2592-c59928474958';
$display->content['new-f259289a-8ef0-6aa4-2592-c59928474958'] = $pane;
$display->panels['two_66_33_first'][0] = 'new-f259289a-8ef0-6aa4-2592-c59928474958';
$pane = new stdClass();
$pane->pid = 'new-a2912068-e5e2-c804-b1ba-3260dc059c9b';
$pane->panel = 'two_66_33_second';
$pane->type = 'views_panes';
$pane->subtype = 'commons_events_organizers-panel_pane_1';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'context' => array(
0 => 'panelizer',
),
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 0;
$pane->locks = array();
$pane->uuid = 'a2912068-e5e2-c804-b1ba-3260dc059c9b';
$display->content['new-a2912068-e5e2-c804-b1ba-3260dc059c9b'] = $pane;
$display->panels['two_66_33_second'][0] = 'new-a2912068-e5e2-c804-b1ba-3260dc059c9b';
$pane = new stdClass();
$pane->pid = 'new-aef85835-68a5-2494-b107-136f1cb92749';
$pane->panel = 'two_66_33_second';
$pane->type = 'views_panes';
$pane->subtype = 'commons_events_event_attendee_list-panel_pane_1';
$pane->shown = TRUE;
$pane->access = array();
$pane->configuration = array(
'use_pager' => 1,
'pager_id' => '0',
'items_per_page' => '20',
'offset' => '0',
'context' => array(
0 => 'panelizer',
),
);
$pane->cache = array();
$pane->style = array(
'settings' => NULL,
);
$pane->css = array();
$pane->extras = array();
$pane->position = 1;
$pane->locks = array();
$pane->uuid = 'aef85835-68a5-2494-b107-136f1cb92749';
$display->content['new-aef85835-68a5-2494-b107-136f1cb92749'] = $pane;
$display->panels['two_66_33_second'][1] = 'new-aef85835-68a5-2494-b107-136f1cb92749';
$display->hide_title = PANELS_TITLE_NONE;
$display->title_pane = '0';
$panelizer->display = $display;
$export['node:event:default'] = $panelizer;
return $export;
}

View File

@ -0,0 +1,40 @@
<?php
/**
* @file
* commons_events_pages.strongarm.inc
*/
/**
* Implements hook_strongarm().
*/
function commons_events_pages_strongarm() {
$export = array();
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
$strongarm->name = 'panelizer_defaults_node_event';
$strongarm->value = array(
'status' => 1,
'view modes' => array(
'page_manager' => array(
'status' => 1,
'default' => 1,
'choice' => 0,
),
'default' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
'teaser' => array(
'status' => 0,
'default' => 0,
'choice' => 0,
),
),
);
$export['panelizer_defaults_node_event'] = $strongarm;
return $export;
}

View File

@ -0,0 +1,37 @@
<?php
/**
* @file
* commons_events_solr.apachesolr_search_defaults.inc
*/
/**
* Implements hook_apachesolr_search_default_searchers().
*/
function commons_events_solr_apachesolr_search_default_searchers() {
$export = array();
$searcher = new stdClass();
$searcher->disabled = FALSE; /* Edit this to true to make a default searcher disabled initially */
$searcher->api_version = 3;
$searcher->page_id = 'solr_events';
$searcher->label = 'Solr Events';
$searcher->description = '';
$searcher->search_path = 'events';
$searcher->page_title = 'Events';
$searcher->env_id = apachesolr_default_environment();
$searcher->settings = array(
'fq' => array(
0 => 'bundle:event',
),
'apachesolr_search_custom_enable' => 1,
'apachesolr_search_search_type' => 'custom',
'apachesolr_search_search_box' => 0,
'apachesolr_search_per_page' => '10',
'apachesolr_search_browse' => 'results',
'apachesolr_search_spellcheck' => 0,
'apachesolr_search_allow_user_input' => 0,
);
$export['solr_events'] = $searcher;
return $export;
}

View File

@ -0,0 +1,26 @@
<?php
/**
* @file
* commons_events_solr.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function commons_events_solr_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "apachesolr_search" && $api == "apachesolr_search_defaults") {
return array("version" => "3");
}
if ($module == "facetapi" && $api == "facetapi_defaults") {
return array("version" => "1");
}
if ($module == "page_manager" && $api == "pages_default") {
return array("version" => "1");
}
if ($module == "pm_existing_pages" && $api == "pm_existing_pages") {
return array("version" => "1");
}
if ($module == "strongarm" && $api == "strongarm") {
return array("version" => "1");
}
}

View File

@ -0,0 +1,21 @@
name = Commons Events - Solr
description = Provides the Solr based faceted search for events
core = 7.x
package = Commons - Search
dependencies[] = apachesolr_search
dependencies[] = commons_events
dependencies[] = ctools
dependencies[] = facetapi
dependencies[] = page_manager
dependencies[] = pm_existing_pages
dependencies[] = strongarm
features[apachesolr_search_page][] = solr_events
features[ctools][] = apachesolr_search:apachesolr_search_defaults:3
features[ctools][] = facetapi:facetapi_defaults:1
features[ctools][] = page_manager:pages_default:1
features[ctools][] = pm_existing_pages:pm_existing_pages:1
features[ctools][] = strongarm:strongarm:1
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

View File

@ -0,0 +1,43 @@
<?php
/**
* @file
* Commons Events Solr install script.
*/
/**
* Implements hook_install().
*/
function commons_events_solr_install() {
// Set module weight to be below rich_snippets, so we can disable snippeting
// on the Solr events landing page.
db_update('system')
->fields(array('weight' => 5))
->condition('name', 'commons_events_solr')
->execute();
}
/**
* Implements hook_enable().
*/
function commons_events_solr_enable() {
module_load_include('inc', 'page_manager', 'plugins/tasks/page');
$page = page_manager_page_load('views_events_landing_page');
ctools_include('export');
ctools_export_set_object_status($page, TRUE);
// Revert base Events feature so that the Events menu link is recreated.
features_revert(array('commons_events' => array('menu_links')));
menu_cache_clear_all();
}
/**
* Implements hook_disable().
*/
function commons_events_solr_disable() {
module_load_include('inc', 'page_manager', 'plugins/tasks/page');
$page = page_manager_page_load('views_events_landing_page');
ctools_include('export');
ctools_export_set_object_status($page, FALSE);
// Revert base Events feature so that the Events menu link is recreated.
features_revert(array('commons_events' => array('menu_links')));
menu_cache_clear_all();
}

Some files were not shown because too many files have changed in this diff Show More