',
'finished' => 'culturefeed_entry_ui_event_form_submission_timeout_batch_finished',
'file' => drupal_get_path('module', 'culturefeed_entry_ui') . '/includes/culturefeed_entry_ui.pages.inc',
);
From 5d40691cc7594910d2d51c2666c72b52e5fb6ab6 Mon Sep 17 00:00:00 2001
From: Hans Langouche
Date: Wed, 10 Sep 2014 14:36:47 +0200
Subject: [PATCH 02/67] MSS-26 watchdog fix
---
.../includes/culturefeed_entry_ui.pages.inc | 2 +-
culturefeed_search/includes/helpers.inc | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc
index a17b25ce..ff4e8eb0 100644
--- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc
+++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc
@@ -3075,7 +3075,7 @@ function culturefeed_entry_ui_photo_after_build($element) {
*/
function culturefeed_entry_ui_event_form_submission_timeout_batch($form_state, &$context) {
// Use the same function to get the event as used on the event page.
- $event_search = culturefeed_search_item_load($form_state['#event_id'], 'event');
+ $event_search = culturefeed_search_item_load($form_state['#event_id'], 'event', FALSE);
$event_updated = FALSE;
if ($event_search) {
diff --git a/culturefeed_search/includes/helpers.inc b/culturefeed_search/includes/helpers.inc
index 5aa684cb..8ce086a3 100644
--- a/culturefeed_search/includes/helpers.inc
+++ b/culturefeed_search/includes/helpers.inc
@@ -35,7 +35,7 @@ function culturefeed_get_search_service() {
* @return mixed
* FALSE if not found, otherwise CultuurNet\Search\ActivityStatsExtendedEntity.
*/
-function culturefeed_search_item_load($cdb_id, $type = '') {
+function culturefeed_search_item_load($cdb_id, $type = '', $watchdog = TRUE) {
$items = &drupal_static(__FUNCTION__, array());
@@ -66,7 +66,9 @@ function culturefeed_search_item_load($cdb_id, $type = '') {
return $items[$cdb_id];
}
catch (Exception $e) {
- watchdog_exception('culturefeed_search', $e);
+ if ($watchdog) {
+ watchdog_exception('culturefeed_search', $e);
+ }
}
}
From ebf51848593e5e59d864adac80fa2ae549e50877 Mon Sep 17 00:00:00 2001
From: Lieven Goudeseune
Date: Thu, 23 Oct 2014 17:14:02 +0200
Subject: [PATCH 03/67] Added autocomplete.
---
culturefeed_pages/culturefeed_pages.module | 8 ++++++++
culturefeed_pages/includes/pages.inc | 8 ++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/culturefeed_pages/culturefeed_pages.module b/culturefeed_pages/culturefeed_pages.module
index 4ef3133e..08501c99 100644
--- a/culturefeed_pages/culturefeed_pages.module
+++ b/culturefeed_pages/culturefeed_pages.module
@@ -455,6 +455,14 @@ function culturefeed_pages_menu() {
'file' => 'includes/pages.inc',
);
+ $items['ajax/culturefeed/pages/page-suggestion/ids'] = array(
+ 'page callback' => 'culturefeed_pages_page_suggestion_autocomplete_page',
+ 'page arguments' => array(5, TRUE),
+ 'access callback' => 'culturefeed_is_culturefeed_user',
+ 'type' => MENU_CALLBACK,
+ 'file' => 'includes/pages.inc',
+ );
+
$items['culturefeed/pages/join/%/%culturefeed_pages_page'] = array(
'page callback' => 'culturefeed_pages_page_join',
'page arguments' => array(3, 4),
diff --git a/culturefeed_pages/includes/pages.inc b/culturefeed_pages/includes/pages.inc
index ec65ef71..5bc06a85 100644
--- a/culturefeed_pages/includes/pages.inc
+++ b/culturefeed_pages/includes/pages.inc
@@ -227,7 +227,7 @@ function culturefeed_pages_page_follow($request_type, $page, $follow = TRUE) {
/**
* Page callback for the page suggestions autocomplete.
*/
-function culturefeed_pages_page_suggestion_autocomplete_page($search_string) {
+function culturefeed_pages_page_suggestion_autocomplete_page($search_string, $return_ids = FALSE) {
$matches = array();
if ($search_string) {
@@ -244,7 +244,11 @@ function culturefeed_pages_page_suggestion_autocomplete_page($search_string) {
if ($suggestions->hasSuggestions()) {
foreach ($suggestions as $suggestion) {
$page = culturefeed_pages_page_load($suggestion->getCdbid());
- $matches[$suggestion->getTitle()] = check_plain($suggestion->getTitle());
+ if ($return_ids) {
+ $matches[$suggestion->getCdbid()] = check_plain($suggestion->getTitle());
+ } else {
+ $matches[$suggestion->getTitle()] = check_plain($suggestion->getTitle());
+ }
}
}
From 731c09c240ec27dda68d66a5ab32690187ca1f9a Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Fri, 24 Oct 2014 10:15:08 +0200
Subject: [PATCH 04/67] Only show the log on text/html requests
---
culturefeed_devel/culturefeed_devel.module | 30 ++++++++++++++++++----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/culturefeed_devel/culturefeed_devel.module b/culturefeed_devel/culturefeed_devel.module
index 05f6e224..68d4260d 100644
--- a/culturefeed_devel/culturefeed_devel.module
+++ b/culturefeed_devel/culturefeed_devel.module
@@ -107,15 +107,35 @@ function culturefeed_devel_shutdown() {
}
// Don't add output on ajax / drush / xml requests.
- $content_type = drupal_get_http_header('content-type');
- if (drupal_is_cli() || $content_type == 'text/xml' || !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
- return;
+ if (culturefeed_devel_show_log() && variable_get('culturefeed_devel_show_requests', TRUE) && user_access('access culturefeed devel information')) {
+ print culturefeed_devel_requests_table($requests, $max_time);
}
- if (variable_get('culturefeed_devel_show_requests', TRUE) && user_access('access culturefeed devel information')) {
- print culturefeed_devel_requests_table($requests, $max_time);
+}
+
+/**
+ * Check if the log should be shown.
+ * @return bool
+ */
+function culturefeed_devel_show_log() {
+
+ $content_type = drupal_get_http_header('content-type');
+ if (strpos($content_type, 'text/html') === FALSE || !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
+ return FALSE;
}
+ return !(
+ function_exists('drupal_is_cli') && drupal_is_cli() ||
+ (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'ApacheBench') !== FALSE) ||
+ !empty($_REQUEST['XDEBUG_PROFILE']) ||
+ isset($GLOBALS['devel_shutdown']) ||
+ strstr($_SERVER['PHP_SELF'], 'update.php') ||
+ (isset($_GET['q']) && (
+ in_array($_GET['q'], array( 'admin/content/node-settings/rebuild')) ||
+ substr($_GET['q'], 0, strlen('system/files')) == 'system/files' ||
+ substr($_GET['q'], 0, strlen('batch')) == 'batch' ||
+ substr($_GET['q'], 0, strlen('file/ajax')) == 'file/ajax')
+ ));
}
/**
From f35be9764aed504d0237d9b2869a21b0e6f66257 Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Tue, 28 Oct 2014 17:11:15 +0100
Subject: [PATCH 05/67] Added functions for validated admin requests
---
culturefeed_pages/culturefeed_pages.module | 9 +++
culturefeed_pages/includes/helpers.inc | 56 ++++++++++++++++++-
culturefeed_pages/includes/members.inc | 48 +++++++++++++---
culturefeed_pages/theme/theme.inc | 6 ++
lib/CultureFeed/CultureFeed/Pages.php | 9 +++
lib/CultureFeed/CultureFeed/Pages/Default.php | 11 +++-
.../CultureFeed/Pages/Membership.php | 6 ++
lib/Drupal/DrupalCultureFeedPages_Cache.php | 7 +++
8 files changed, 142 insertions(+), 10 deletions(-)
diff --git a/culturefeed_pages/culturefeed_pages.module b/culturefeed_pages/culturefeed_pages.module
index 08501c99..5a4710a7 100644
--- a/culturefeed_pages/culturefeed_pages.module
+++ b/culturefeed_pages/culturefeed_pages.module
@@ -437,6 +437,15 @@ function culturefeed_pages_menu() {
'file' => 'includes/members.inc',
);
+ $items['pages/%culturefeed_pages_page/membership/request-validated-admin/%'] = array(
+ 'title' => 'Request to become validated admin',
+ 'page callback' => 'culturefeed_pages_page_request_validated_admin',
+ 'page arguments' => array(1, 4),
+ 'access callback' => 'culturefeed_is_culturefeed_user',
+ 'type' => MENU_CALLBACK,
+ 'file' => 'includes/members.inc',
+ );
+
$items['pages/switch/%culturefeed_pages_page'] = array(
'title callback' => FALSE,
'title' => t('Change active page'),
diff --git a/culturefeed_pages/includes/helpers.inc b/culturefeed_pages/includes/helpers.inc
index 07941372..c17655af 100644
--- a/culturefeed_pages/includes/helpers.inc
+++ b/culturefeed_pages/includes/helpers.inc
@@ -129,6 +129,34 @@ function culturefeed_pages_is_user_admin_of_page($page_id, $cf_account = NULL) {
}
+/**
+ * Is the given user validated admin of a given page.
+ * @return bool
+ */
+function culturefeed_pages_is_user_validated_admin_of_page($page_id, $cf_account = NULL) {
+
+ try {
+
+ if (empty($cf_account)) {
+ $cf_account = DrupalCultureFeed::getLoggedInUser();
+ }
+
+ if (!empty($cf_account->pageMemberships)) {
+ foreach ($cf_account->pageMemberships as $membership) {
+ if ($membership->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN && $membership->page->getId() == $page_id && $membership->validated) {
+ return TRUE;
+ }
+ }
+ }
+ }
+ catch (Exception $e) {
+ watchdog_exception('culturefeed_pages', $e);
+ }
+
+ return FALSE;
+
+}
+
/**
* Is the current user following a given page id.
* @param string $page_id
@@ -443,7 +471,7 @@ function culturefeed_pages_get_admins_of_page(CultureFeed_Cdb_Item_Page $page) {
}
catch (Exception $e) {
watchdog_exception('culturefeed_pages', $e);
- $admin_list = new CultureFeed_Pages_UserList();
+ return array();
}
foreach ($admin_list->memberships as $admin) {
@@ -453,6 +481,30 @@ function culturefeed_pages_get_admins_of_page(CultureFeed_Cdb_Item_Page $page) {
return $admins_of_page;
}
+/**
+ * Get all the validated admins of a given page.
+ * @param CultureFeed_Cdb_Item_Page $page
+ */
+function culturefeed_pages_get_validated_admins_of_page(CultureFeed_Cdb_Item_Page $page) {
+
+ try {
+ $cf_pages = DrupalCultureFeed::getLoggedInUserInstance()->pages();
+ $admin_list = $cf_pages->getUserList($page->getId(), array(CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN), FALSE);
+ }
+ catch (Exception $e) {
+ watchdog_exception('culturefeed_pages', $e);
+ return array();
+ }
+
+ foreach ($admin_list->memberships as $admin) {
+ if ($admin->validated) {
+ $admins_of_page[$admin->user->id] = $admin->user->id;
+ }
+ }
+
+ return $admins_of_page;
+}
+
/**
* Get the themed list of page suggestions.
*/
@@ -481,7 +533,7 @@ function culturefeed_pages_get_page_suggestions_list() {
$parameters[] = new CultuurNet\Search\Parameter\Query($query);
}
else {
- $parameters[] = new CultuurNet\Search\Parameter\Query('*:*');
+ $parameters[] = new CultuurNet\Search\Parameter\Query('*:*');
}
// Search on postal / city.
diff --git a/culturefeed_pages/includes/members.inc b/culturefeed_pages/includes/members.inc
index f7fe8d0a..5f9cfe53 100644
--- a/culturefeed_pages/includes/members.inc
+++ b/culturefeed_pages/includes/members.inc
@@ -288,12 +288,12 @@ function culturefeed_pages_edit_membership_form_submit(&$form, &$form_state) {
function culturefeed_pages_search_user_form() {
$form = array();
-
+
$form['title'] = array(
'#markup' => t('Add new members'),
'#weight' => -999,
);
-
+
$form['search'] = array(
'#title' => t('Keyword'),
'#type' => 'textfield',
@@ -407,7 +407,7 @@ function culturefeed_pages_add_member_form_submit($form, &$form_state) {
try {
$params = array('activityPrivate' => FALSE);
DrupalCultureFeed::getLoggedInUserInstance()->pages()->addMember($form_state['page']->getId(), $form_state['user']->id, $params);
- $message = format_string(t('@nick is member of @page now.'), array('@nick' => $form_state['user']->nick, '@page' => $page->getName()));
+ $message = t('@nick is member of @page now.', array('@nick' => $form_state['user']->nick, '@page' => $page->getName()));
drupal_set_message($message);
}
catch (Exception $e) {
@@ -529,13 +529,13 @@ function culturefeed_pages_delete_member_form_submit($form, &$form_state) {
if ($form_state['my_pages']) {
$form_state['redirect'] = 'culturefeed/pages';
- $message = format_string(t('You are not longer a member of @page.'), array(
+ $message = t('You are not longer a member of @page.', array(
'@page' => $form_state['page']->getName())
);
}
else {
$form_state['redirect'] = 'pages/' . $form_state['page']->getId() . '/members/nojs';
- $message = format_string(t('User @nick is removed as member of page @page.'), array(
+ $message = t('User @nick is removed as member of page @page.', array(
'@nick' => $form_state['user']->nick,
'@page' => $form_state['page']->getName())
);
@@ -608,7 +608,7 @@ function culturefeed_pages_page_request_admin_membership_approved($form, &$form_
$drupal_uid = culturefeed_get_uid_for_cf_uid($cf_user->id, $cf_user->nick);
$page_title = $page->getName();
- $message = format_string(t('!username wants to be an administrator of !page.'), array(
+ $message = t('!username wants to be an administrator of !page.', array(
'!username' => l($cf_user->nick, 'user/' . $drupal_uid),
'!page' => l($page_title, culturefeed_search_detail_path('page', $page->getId(), $page_title)),
));
@@ -640,7 +640,7 @@ function culturefeed_pages_page_request_admin_membership_approved_submit($form,
$page_title = $page->getName();
$page_path = culturefeed_search_detail_path('page', $page->getId(), $page_title);
- $message = format_string(t('!username successfully added as administrator of page !page.'), array(
+ $message = t('!username successfully added as administrator of page !page.', array(
'!username' => l($cf_user->nick, 'user/' . $drupal_uid),
'!page' => l($page_title, $page_path),
));
@@ -663,3 +663,37 @@ function culturefeed_pages_page_request_admin_membership_approved_submit($form,
drupal_goto($page_path);
}
+
+/**
+ * Sent a request to become validated admin.
+ */
+function culturefeed_pages_page_request_validated_admin($page, $request_type) {
+
+ // Send request to become a validated admin.
+ try {
+
+ $cf_pages = DrupalCultureFeed::getLoggedInUserInstance()->pages();
+ $cf_pages->addValidatedadmin($page->getId());
+ $message = t('Your request to become a validated administrator of this page is sent');
+
+ }
+ catch (Exception $e) {
+ watchdog_exception('culturefeed_pages', $e);
+ $message = t('The request could not be sent.');
+ }
+
+ if ($type == 'ajax') {
+ $commands = array();
+
+ if ($success) {
+ $commands[] = ajax_command_html('#request_validated_adminship_link_' . $page->getId() . '_wrapper', $message);
+ }
+
+ ajax_deliver(array('#type' => 'ajax', '#commands' => $commands));
+ }
+ else {
+ drupal_set_message($message);
+ drupal_goto();
+ }
+
+}
\ No newline at end of file
diff --git a/culturefeed_pages/theme/theme.inc b/culturefeed_pages/theme/theme.inc
index 2b8a82f2..f3372b04 100644
--- a/culturefeed_pages/theme/theme.inc
+++ b/culturefeed_pages/theme/theme.inc
@@ -193,6 +193,12 @@ function _culturefeed_pages_preprocess_culturefeed_page(&$variables) {
$query = array('destination' => culturefeed_search_detail_path('page', $page->getId(), $page->getName()), '/');
$variables['become_member_link'] = l(t('Become a member'), 'culturefeed/pages/join/nojs/' . $page->getId(), array('query' => $query));
}
+ else {
+ if (culturefeed_pages_is_user_member_of_page($page->getId()) && !culturefeed_pages_is_user_validated_admin_of_page($page->getId())) {
+ $query = array('destination' => culturefeed_search_detail_path('page', $page->getId(), $page->getName()), '/');
+ $variables['become_validated_admin_link'] = l(t('Become a validated admin'), 'culturefeed/pages/validated-admin/nojs/' . $page->getId(), array('query' => $query));
+ }
+ }
// Address information
$address = $page->getAddress();
diff --git a/lib/CultureFeed/CultureFeed/Pages.php b/lib/CultureFeed/CultureFeed/Pages.php
index cc41feca..f0a3e5a2 100644
--- a/lib/CultureFeed/CultureFeed/Pages.php
+++ b/lib/CultureFeed/CultureFeed/Pages.php
@@ -168,6 +168,15 @@ public function addAdmin($id, $userId, $params = array());
*/
public function removeAdmin($id, $userId);
+ /**
+ * Send a request for current user to become validated admin.
+ * @param string $id
+ * The page ID to add to.
+ * @return string
+ * Message returned by the service.
+ */
+ public function addValidatedAdmin($id);
+
/**
* Get the timeline of a page.
* @param string $id
diff --git a/lib/CultureFeed/CultureFeed/Pages/Default.php b/lib/CultureFeed/CultureFeed/Pages/Default.php
index b85dea12..b0f3069f 100644
--- a/lib/CultureFeed/CultureFeed/Pages/Default.php
+++ b/lib/CultureFeed/CultureFeed/Pages/Default.php
@@ -96,7 +96,6 @@ public function getConsumer() {
public function getPage($id) {
$result = $this->oauth_client->consumerGetAsXml('page/' . $id);
-
try {
$xml = new CultureFeed_SimpleXMLElement($result);
}
@@ -242,6 +241,7 @@ public function getUserList($id, $roles = array(), $use_auth = TRUE) {
$membership->role = $object->xpath_str('pageRole');
$membership->relation = $object->xpath_str('relation');
$membership->creationDate = $object->xpath_time('creationDate');
+ $membership->validated = $object->xpath_bool('validated');
$userList->memberships[] = $membership;
@@ -361,6 +361,15 @@ public function removeAdmin($id, $userId) {
}
+ /**
+ * @see CultureFeed_Pages::addValidatedAdmin()
+ */
+ public function addValidatedAdmin($id) {
+ $result = $this->oauth_client->authenticatedPostAsXml('page/' . $id . '/validatedadmin/add');
+ $xmlElement = $this->validateResult($result, CultureFeed_Pages_Default::CODE_ACTION_SUCCEEDED);
+ return $xmlElement->xpath_str('message');
+ }
+
/**
* @see CultureFeed_Pages::getTimeline()
*/
diff --git a/lib/CultureFeed/CultureFeed/Pages/Membership.php b/lib/CultureFeed/CultureFeed/Pages/Membership.php
index 971cc3fc..8b42de38 100644
--- a/lib/CultureFeed/CultureFeed/Pages/Membership.php
+++ b/lib/CultureFeed/CultureFeed/Pages/Membership.php
@@ -37,4 +37,10 @@ class CultureFeed_Pages_Membership {
*/
public $relation;
+ /**
+ * A validated membership or not.
+ * @var bool
+ */
+ public $validated;
+
}
\ No newline at end of file
diff --git a/lib/Drupal/DrupalCultureFeedPages_Cache.php b/lib/Drupal/DrupalCultureFeedPages_Cache.php
index 0dad0384..7e02628f 100644
--- a/lib/Drupal/DrupalCultureFeedPages_Cache.php
+++ b/lib/Drupal/DrupalCultureFeedPages_Cache.php
@@ -258,6 +258,13 @@ public function removeAdmin($id, $userId) {
$this->clearUserListCache($id, CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN);
}
+ /**
+ * @see CultureFeed_Pages::addValidatedAdmin()
+ */
+ public function addValidatedAdmin($id) {
+ return $this->realCultureFeedPages->addValidatedAdmin($id);
+ }
+
/**
* @see CultureFeed_Pages::getTimeline()
*/
From e06a021504af0ccfe4ab2aa532e4571a01408a1b Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Tue, 28 Oct 2014 17:29:51 +0100
Subject: [PATCH 06/67] Check if recipientPage is instance of
CultureFeed_Cdb_Item_Page
---
culturefeed_messages/includes/pages.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/culturefeed_messages/includes/pages.inc b/culturefeed_messages/includes/pages.inc
index 46371c74..04e13d90 100644
--- a/culturefeed_messages/includes/pages.inc
+++ b/culturefeed_messages/includes/pages.inc
@@ -134,7 +134,7 @@ function culturefeed_messages_new_message_form($form, &$form_state, $object = NU
}
// Always use recipientPage as senderPage in replies
- if ($object instanceof CultureFeed_Messages_Message && !empty($object->recipientPage)) {
+ if ($object instanceof CultureFeed_Messages_Message && $object->recipientPage instanceof CultureFeed_Cdb_Item_Page) {
$form['send_as'] = array(
'#type' => 'hidden',
'#default_value' => $object->recipientPage->getId(),
From d0afd8b749a205174395a62b44bd3a4124ff4c1b Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Tue, 28 Oct 2014 17:39:10 +0100
Subject: [PATCH 07/67] Added helper function to check if page is a validated
page
---
culturefeed_pages/includes/helpers.inc | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/culturefeed_pages/includes/helpers.inc b/culturefeed_pages/includes/helpers.inc
index c0b43a52..0f9a7c93 100644
--- a/culturefeed_pages/includes/helpers.inc
+++ b/culturefeed_pages/includes/helpers.inc
@@ -185,6 +185,18 @@ function culturefeed_pages_is_user_following_page($page_id) {
}
+/**
+ * Check if current page is a validated page.
+ *
+ * @param CultureFeed_Cdb_Item_Page $page
+ * Page to check
+ * @return bool
+ */
+function culturefeed_pages_page_is_validated_page(CultureFeed_Cdb_Item_Page $page) {
+ $validated_admins = culturefeed_pages_get_validated_admins_of_page($page);
+ return count($validated_admins) > 0;
+}
+
/**
* Get the page that currently is beïng viewed. This can be via a news item, or via the page itself.
*/
@@ -565,3 +577,4 @@ function culturefeed_pages_get_page_suggestions_list() {
return theme('culturefeed_pages_page_suggestion_list', array('suggestions' => $result->getItems()));
}
+
From 6b5942e403f5632e429aee9fc372298a21dcb303 Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Wed, 29 Oct 2014 12:25:15 +0100
Subject: [PATCH 08/67] Added functionality to remove validated admins: TBC
---
culturefeed_pages/includes/members.inc | 64 +++++++++++++++----
culturefeed_pages/theme/theme.inc | 2 +-
lib/CultureFeed/CultureFeed/Pages/Default.php | 8 +++
3 files changed, 60 insertions(+), 14 deletions(-)
diff --git a/culturefeed_pages/includes/members.inc b/culturefeed_pages/includes/members.inc
index 5f9cfe53..f511720e 100644
--- a/culturefeed_pages/includes/members.inc
+++ b/culturefeed_pages/includes/members.inc
@@ -101,7 +101,14 @@ function culturefeed_pages_manage_members_list(CultureFeed_Cdb_Item_Page $page,
$row['function'] = $member->relation;
switch ($member->role) {
case CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN:
- $role = t('administrator');
+
+ if ($member->validated) {
+ $role = t('validated administrator');
+ }
+ else {
+ $role = t('administrator');
+ }
+
break;
case CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_MEMBER:
default:
@@ -112,11 +119,17 @@ function culturefeed_pages_manage_members_list(CultureFeed_Cdb_Item_Page $page,
$row['member_since'] = date('d/m/Y H:i', $member->creationDate);
$row['edit'] = l(t('Edit'), 'pages/' . $page->getId() . '/membership/' . $member->user->id . '/edit/nojs', array('attributes' => array('class' => 'use-ajax')));
- if ($total_admins == 1 && $member->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN) {
+ if ($total_admins == 1 && !$member->validated && $member->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN) {
$row['delete'] = theme('culturefeed_pages_membership_delete_not_possible', array('page' => $page));
}
else {
- $row['delete'] = l(t('Remove as member'), 'pages/' . $page->getId() . '/membership/' . $member->user->id . '/delete/nojs');
+ if ($member->validated) {
+ $delete_label = t('Remove as validated administrator');
+ }
+ else {
+ $delete_label = t('Remove as member');
+ }
+ $row['delete'] = l($delete_label, 'pages/' . $page->getId() . '/membership/' . $member->user->id . '/delete/nojs');
}
}
// Show the edit form.
@@ -198,10 +211,18 @@ function culturefeed_pages_edit_membership_form($form, &$form_state, CultureFeed
// Only show toggle when user is not an admin, or he is not the only admin.
if ($membership->role != CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN || $total_admins != 1) {
+
+ if ($membership->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_MEMBER) {
+ $toggle_label = t('Make administrator');
+ }
+ else {
+ $toggle_label = $membership->validated ? t('Remove administrator') : t('Remove validated administrator');
+ }
+
$form['role'] = array(
'#type' => 'button',
'#name' => 'toggle_role',
- '#value' => $membership->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN ? t('Remove administrator') : t('Make administrator'),
+ '#value' => $toggle_label,
'#ajax' => array(
'callback' => 'culturefeed_pages_edit_membership_ajax_form_submit',
'wrapper' => 'membership-ajax-wrapper',
@@ -230,16 +251,25 @@ function culturefeed_pages_edit_membership_form_validate($form, &$form_state) {
$cf_pages = DrupalCultureFeed::getLoggedInUserInstance()->pages();
if ($form['#membership']->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN) {
- $cf_pages->removeAdmin($form['#membership']->page->getId(), $form['#membership']->user->id);
+ // If he is a validated admin. Remove him as validated admin. He becomes a normal admin.
+ if ($form['#membership']->validated) {
+ $cf_pages->removeValidatedAdmin($form['#membership']->page->getId());
+ $form_state['new_role'] = CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN;
+ }
+ else {
- // If he was removed as admin, he is also removed as member. Re-add him as member.
- $params = array(
- 'relation' => $form['#membership']->relation,
- 'activityPrivate' => FALSE,
- );
+ $cf_pages->removeAdmin($form['#membership']->page->getId(), $form['#membership']->user->id);
- $cf_pages->addMember($form['#membership']->page->getId(), $form['#membership']->user->id, $params);
- $form_state['new_role'] = CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_MEMBER;
+ // If he was removed as admin, he is also removed as member. Re-add him as member.
+ $params = array(
+ 'relation' => $form['#membership']->relation,
+ 'activityPrivate' => FALSE,
+ );
+
+ $cf_pages->addMember($form['#membership']->page->getId(), $form['#membership']->user->id, $params);
+ $form_state['new_role'] = CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_MEMBER;
+
+ }
}
else {
@@ -508,7 +538,15 @@ function culturefeed_pages_delete_member_form_validate($form, &$form_state) {
// Check if the user is admin or member.
if (culturefeed_pages_is_user_admin_of_page($form_state['page']->getId(), $form_state['user'])) {
- DrupalCultureFeed::getLoggedInUserInstance()->pages()->removeAdmin($form_state['page']->getId(), $form_state['user']->id);
+
+ // If a validated admin is removed, he becomes a normal admin.
+ if (culturefeed_pages_is_user_validated_admin_of_page($form_state['page']->getId(), $form_state['user'])) {
+ DrupalCultureFeed::getLoggedInUserInstance()->pages()->removeValidatedAdmin($form_state['page']->getId());
+ }
+ else {
+ DrupalCultureFeed::getLoggedInUserInstance()->pages()->removeAdmin($form_state['page']->getId(), $form_state['user']->id);
+ }
+
}
else {
DrupalCultureFeed::getLoggedInUserInstance()->pages()->removeMember($form_state['page']->getId(), $form_state['user']->id);
diff --git a/culturefeed_pages/theme/theme.inc b/culturefeed_pages/theme/theme.inc
index f3372b04..e9e58dd2 100644
--- a/culturefeed_pages/theme/theme.inc
+++ b/culturefeed_pages/theme/theme.inc
@@ -196,7 +196,7 @@ function _culturefeed_pages_preprocess_culturefeed_page(&$variables) {
else {
if (culturefeed_pages_is_user_member_of_page($page->getId()) && !culturefeed_pages_is_user_validated_admin_of_page($page->getId())) {
$query = array('destination' => culturefeed_search_detail_path('page', $page->getId(), $page->getName()), '/');
- $variables['become_validated_admin_link'] = l(t('Become a validated admin'), 'culturefeed/pages/validated-admin/nojs/' . $page->getId(), array('query' => $query));
+ $variables['become_validated_admin_url'] = url('culturefeed/pages/validated-admin/nojs/' . $page->getId(), array('query' => $query));
}
}
diff --git a/lib/CultureFeed/CultureFeed/Pages/Default.php b/lib/CultureFeed/CultureFeed/Pages/Default.php
index b0f3069f..8ef4102d 100644
--- a/lib/CultureFeed/CultureFeed/Pages/Default.php
+++ b/lib/CultureFeed/CultureFeed/Pages/Default.php
@@ -370,6 +370,14 @@ public function addValidatedAdmin($id) {
return $xmlElement->xpath_str('message');
}
+ /**
+ * @see CultureFeed_Pages::removeValidatedAdmin()
+ */
+ public function removeValidatedAdmin($id) {
+ $result = $this->oauth_client->authenticatedPostAsXml('page/' . $id . '/validatedadmin/remove');
+ $this->validateResult($result, CultureFeed_Pages_Default::CODE_ACTION_SUCCEEDED);
+ }
+
/**
* @see CultureFeed_Pages::getTimeline()
*/
From 5e5e6dfe52dd775d0d18269b684aaedea861849f Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Wed, 29 Oct 2014 15:27:10 +0100
Subject: [PATCH 09/67] Use correct url for validated admin request
---
culturefeed_pages/includes/helpers.inc | 2 +-
culturefeed_pages/includes/members.inc | 2 +-
culturefeed_pages/theme/theme.inc | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/culturefeed_pages/includes/helpers.inc b/culturefeed_pages/includes/helpers.inc
index 0f9a7c93..2e56ddeb 100644
--- a/culturefeed_pages/includes/helpers.inc
+++ b/culturefeed_pages/includes/helpers.inc
@@ -432,7 +432,7 @@ function culturefeed_pages_block_request_admin_membership(CultureFeed_Cdb_Item_P
if ($is_admin) {
return;
}
-
+return;
$build = array(
'#theme' => 'culturefeed_pages_request_admin_membership_block',
'#page' => $page,
diff --git a/culturefeed_pages/includes/members.inc b/culturefeed_pages/includes/members.inc
index f511720e..ab78c668 100644
--- a/culturefeed_pages/includes/members.inc
+++ b/culturefeed_pages/includes/members.inc
@@ -720,7 +720,7 @@ function culturefeed_pages_page_request_validated_admin($page, $request_type) {
$message = t('The request could not be sent.');
}
- if ($type == 'ajax') {
+ if ($request_type == 'ajax') {
$commands = array();
if ($success) {
diff --git a/culturefeed_pages/theme/theme.inc b/culturefeed_pages/theme/theme.inc
index e9e58dd2..0a09b871 100644
--- a/culturefeed_pages/theme/theme.inc
+++ b/culturefeed_pages/theme/theme.inc
@@ -196,7 +196,7 @@ function _culturefeed_pages_preprocess_culturefeed_page(&$variables) {
else {
if (culturefeed_pages_is_user_member_of_page($page->getId()) && !culturefeed_pages_is_user_validated_admin_of_page($page->getId())) {
$query = array('destination' => culturefeed_search_detail_path('page', $page->getId(), $page->getName()), '/');
- $variables['become_validated_admin_url'] = url('culturefeed/pages/validated-admin/nojs/' . $page->getId(), array('query' => $query));
+ $variables['become_validated_admin_url'] = url('pages/' . $page->getId() . '/membership/request-validated-admin/nojs', array('query' => $query));
}
}
From 2cc4cd15977df7e7e484aa76f04013721b88d319 Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Wed, 29 Oct 2014 15:27:25 +0100
Subject: [PATCH 10/67] Remove the return
---
culturefeed_pages/includes/helpers.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/culturefeed_pages/includes/helpers.inc b/culturefeed_pages/includes/helpers.inc
index 2e56ddeb..0f9a7c93 100644
--- a/culturefeed_pages/includes/helpers.inc
+++ b/culturefeed_pages/includes/helpers.inc
@@ -432,7 +432,7 @@ function culturefeed_pages_block_request_admin_membership(CultureFeed_Cdb_Item_P
if ($is_admin) {
return;
}
-return;
+
$build = array(
'#theme' => 'culturefeed_pages_request_admin_membership_block',
'#page' => $page,
From 9ba7fcb7d00eb1d281b9d6232f7cd8d834362f6d Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Mon, 10 Nov 2014 16:53:37 +0100
Subject: [PATCH 11/67] Added setting for filtering the options
---
.../culturefeed_search_ui.module | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index 5bf38f1b..f237e069 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -374,6 +374,20 @@ function culturefeed_search_ui_block_configure($delta) {
);
}
+ // Disable possible facet options.
+ if ($delta == 'facet-facility') {
+
+ $options = culturefeed_search_get_categories_by_domain($delta_parts[1]);
+ $enabled_options = variable_get('culturefeed_facet_enabled_options', NULL);
+
+ $form['culturefeed-facet-enabled-options'] = array(
+ '#type' => 'checkboxes',
+ '#title' => t('Show only selected options'),
+ '#options' => $options,
+ '#default_value' => $enabled_options !== NULL && isset($enabled_options[$delta_parts[1]]) ? $enabled_options[$delta_parts[1]] : array_keys($options),
+ );
+ }
+
if ($delta == 'facet-theme') {
$form['culturefeed-facet-theme-hide'] = array(
'#type' => 'checkbox',
@@ -590,6 +604,14 @@ function culturefeed_search_ui_block_save($delta, $edit = array()) {
variable_set('culturefeed_facet_show_subitems_' . $delta, $edit['culturefeed-facet-show-subitems']);
}
+ // Save enabled facet options.
+ if (isset($edit['culturefeed-facet-enabled-options'])) {
+ $delta_parts = explode('-', $delta);
+ $options = variable_get('culturefeed_facet_enabled_options', array());
+ $options[$delta_parts[1]] = array_filter($edit['culturefeed-facet-enabled-options']);
+ variable_set('culturefeed_facet_enabled_options', $options);
+ }
+
if ($delta == 'culturefeed-search-sortorder') {
if (!empty($edit['sort_options'])) {
From 0ddfb64ae598ed1f49b7afa0bc9c16977466430a Mon Sep 17 00:00:00 2001
From: HnLn
Date: Thu, 13 Nov 2014 15:21:11 +0100
Subject: [PATCH 12/67] MSS-91
---
culturefeed_search_ui/culturefeed_search_ui.module | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index 5bf38f1b..39f8307b 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -900,6 +900,7 @@ function culturefeed_search_ui_culturefeed_search_ui_active_filters($culturefeed
unset($query['min_age']);
$url = url($path, array('query' => $query));
+ $current_age = t('All ages');
$age_facets = culturefeed_search_ui_get_age_range_facet_options();
foreach ($age_facets as $key => $data) {
if ($key === $min_age) {
@@ -907,16 +908,9 @@ function culturefeed_search_ui_culturefeed_search_ui_active_filters($culturefeed
}
}
- if ($min_age == 0) {
- $label = t('All ages');
- }
- else {
- $label = isset($current_age) ? $current_age : check_plain($min_age);
- }
-
$build['min-age'] = array(
'#theme' => 'culturefeed_search_active_filters_item',
- '#label' => $min_age == 0 ? t('All ages') : $current_age,
+ '#label' => $current_age,
'#url' => $url
);
}
From dff30df9ad41b309400714bd1f4ad1fe14b0a2ea Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Thu, 13 Nov 2014 15:52:33 +0100
Subject: [PATCH 13/67] Added setting for listing actors on the search page
---
culturefeed_agenda/culturefeed_agenda.module | 9 ++++
culturefeed_agenda/includes/admin.inc | 43 +++++++++++++++++++
.../lib/Drupal/AgendaSearchPage.php | 6 ++-
.../culturefeed_search_ui.module | 12 +++++-
culturefeed_search_ui/includes/blocks.inc | 18 ++++++++
5 files changed, 86 insertions(+), 2 deletions(-)
create mode 100644 culturefeed_agenda/includes/admin.inc
diff --git a/culturefeed_agenda/culturefeed_agenda.module b/culturefeed_agenda/culturefeed_agenda.module
index ff0ff8dc..5a9f34d8 100644
--- a/culturefeed_agenda/culturefeed_agenda.module
+++ b/culturefeed_agenda/culturefeed_agenda.module
@@ -172,6 +172,15 @@ function culturefeed_agenda_menu() {
'file' => 'includes/pages.inc',
);
+ $items['admin/config/culturefeed/agenda'] = array(
+ 'title' => 'CultureFeed Agenda',
+ 'description' => 'Change CultureFeed Agenda settings',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('culturefeed_agenda_admin_settings_form'),
+ 'access arguments' => array('administer site configuration'),
+ 'file' => 'includes/admin.inc',
+ );
+
// Autocomplete for event / production suggestions
$items['autocomplete/culturefeed/activity-suggestion'] = array(
'page callback' => 'culturefeed_agenda_activity_suggestion_autocomplete_page',
diff --git a/culturefeed_agenda/includes/admin.inc b/culturefeed_agenda/includes/admin.inc
new file mode 100644
index 00000000..b9206736
--- /dev/null
+++ b/culturefeed_agenda/includes/admin.inc
@@ -0,0 +1,43 @@
+ t('Entity types to be searched'),
+ '#type' => 'checkboxes',
+ '#options' => array(
+ 'event' => t('Events'),
+ 'production' => t('Productions'),
+ 'actor' => t('Actors'),
+ ),
+ '#default_value' => variable_get('culturefeed_agenda_active_entity_types', array('event', 'production')),
+ '#description' => t('Select the different entity types that can be shown on agenda/search'),
+ );
+
+ $form = system_settings_form($form);
+ $form['#submit'] = array('culturefeed_agenda_admin_settings_form_submit');
+
+ return $form;
+
+}
+
+/**
+ * Submit the settings form.
+ */
+function culturefeed_agenda_admin_settings_form_submit($form, $form_state) {
+
+ $form_state['values']['culturefeed_agenda_active_entity_types'] = array_filter($form_state['values']['culturefeed_agenda_active_entity_types']);
+ system_settings_form_submit($form, $form_state);
+
+}
+
diff --git a/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php b/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
index c7b61538..41e43ef8 100644
--- a/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
+++ b/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
@@ -39,7 +39,11 @@ public function initialize() {
$this->addFacetFilters($params);
- $this->parameters[] = new Parameter\FilterQuery('type:event OR type:production');
+ $active_types = variable_get('culturefeed_agenda_active_entity_types', array('event', 'production'));
+ array_walk($active_types, function(&$active_type) {
+ $active_type = 'type:' . $active_type;
+ });
+ $this->parameters[] = new Parameter\FilterQuery(implode(' OR ', $active_types));
$this->parameters[] = $this->facetComponent->facetField('category');
$this->parameters[] = $this->facetComponent->facetField('datetype');
$this->parameters[] = $this->facetComponent->facetField('city');
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index 5bf38f1b..82e6775b 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -297,6 +297,11 @@ function culturefeed_search_ui_block_info() {
'cache' => DRUPAL_NO_CACHE,
);
+ $blocks['facet-type'] = array(
+ 'info' => t('Culturefeed search: facet entity type'),
+ 'cache' => DRUPAL_NO_CACHE,
+ );
+
$blocks['facet-datetype'] = array(
'info' => t('Culturefeed search: facet when'),
'cache' => DRUPAL_NO_CACHE,
@@ -666,6 +671,10 @@ function culturefeed_search_ui_block_view($delta) {
$block = culturefeed_search_ui_block_age_range_facet();
break;
+ case 'facet-type':
+ $block = culturefeed_search_ui_block_entity_type_facet();
+ break;
+
case 'filter-form':
$search_result = culturefeed_get_search_result();
@@ -721,10 +730,11 @@ function culturefeed_search_ui_culturefeed_search_page_query_alter(CultureFeedSe
}
}
- // Add facet on agefrom.
+ // Add facet on agefrom and type.
$facet_component = culturefeed_get_facet_component();
if ($facet_component) {
$culturefeedSearchPage->addParameter($facet_component->facetField('agefrom'));
+ $culturefeedSearchPage->addParameter($facet_component->facetField('type'));
}
// Add min age filter. This is always the requested age and count till 12.
diff --git a/culturefeed_search_ui/includes/blocks.inc b/culturefeed_search_ui/includes/blocks.inc
index 6141fe3c..791ef9a5 100644
--- a/culturefeed_search_ui/includes/blocks.inc
+++ b/culturefeed_search_ui/includes/blocks.inc
@@ -593,6 +593,24 @@ function culturefeed_search_ui_city_only_facet_form_submit($form, &$form_state)
}
+/**
+ * Show the entity type facet.
+ */
+function culturefeed_search_ui_block_entity_type_facet() {
+
+ $block_settings = array(
+ 'sort' => variable_get('culturefeed_search_sort_facet-type', CULTUREFEED_SEARCH_SORT_ALPHABETICALLY),
+ 'highest_level' => variable_get('culturefeed_facet_highest_level_facet-type', 1),
+ 'show_subitems' => variable_get('culturefeed_facet_show_subitems_facet-type', FALSE),
+ );
+
+ $block = culturefeed_search_ui_search_facets_block('type', '', array(), $block_settings);
+ $block['subject'] = t('Type');
+
+ return $block;
+
+}
+
/**
* Block callback for the active filters during search.
*/
From f6e8292dd5a99535c0a330331311afa23ce4d861 Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Fri, 14 Nov 2014 10:05:41 +0100
Subject: [PATCH 14/67] Make titles translatable
---
culturefeed_ui/culturefeed_ui.module | 37 +++++++++-------------------
1 file changed, 11 insertions(+), 26 deletions(-)
diff --git a/culturefeed_ui/culturefeed_ui.module b/culturefeed_ui/culturefeed_ui.module
index 76a7ae8f..85bacd5e 100644
--- a/culturefeed_ui/culturefeed_ui.module
+++ b/culturefeed_ui/culturefeed_ui.module
@@ -22,8 +22,7 @@ function culturefeed_ui_menu() {
'file' => 'culturefeed_ui.admin.inc',
);
$items['culturefeed/profile/edit'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Edit profile'),
+ 'title' => 'Edit profile',
'page callback' => 'drupal_get_form',
'page arguments' => array('culturefeed_ui_page_profile_edit_form'),
'access callback' => 'culturefeed_is_culturefeed_user',
@@ -31,24 +30,21 @@ function culturefeed_ui_menu() {
'file' => 'culturefeed_ui.pages.inc',
);
$items['culturefeed/account/edit'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Edit account'),
+ 'title' => 'Edit account',
'page callback' => 'culturefeed_ui_page_account_edit',
'access callback' => 'culturefeed_is_culturefeed_user',
'type' => MENU_CALLBACK,
'file' => 'culturefeed_ui.pages.inc',
);
$items['culturefeed/mboxverify/resend'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Resend email confirmation'),
+ 'title' => 'Resend email confirmation',
'page callback' => 'culturefeed_ui_page_mboxverify_resend',
'access callback' => 'culturefeed_is_culturefeed_user',
'type' => MENU_CALLBACK,
'file' => 'culturefeed_ui.pages.inc',
);
$items['culturefeed/users/search'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Search users'),
+ 'title' => 'Search users',
'page callback' => 'culturefeed_ui_page_users_search',
'page arguments' => array(3),
'access arguments' => array('access content'),
@@ -56,16 +52,14 @@ function culturefeed_ui_menu() {
'file' => 'culturefeed_ui.pages.inc',
);
$items['culturefeed/serviceconsumers'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Connected channels'),
+ 'title' => 'Connected channels',
'page callback' => 'culturefeed_ui_page_serviceconsumers',
'access callback' => 'culturefeed_is_culturefeed_user',
'type' => MENU_CALLBACK,
'file' => 'culturefeed_ui.pages.inc',
);
$items['culturefeed/serviceconsumers/revoke/%/%'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Remove UiTiD channel'),
+ 'title' => 'Remove UiTiD channel',
'page callback' => 'culturefeed_ui_page_serviceconsumer_revoke',
'page arguments' => array(3, 4),
'access callback' => 'culturefeed_is_culturefeed_user',
@@ -73,8 +67,7 @@ function culturefeed_ui_menu() {
'file' => 'culturefeed_ui.pages.inc',
);
$items['culturefeed/onlineaccounts/delete/%/%/%'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Remove social account'),
+ 'title' => 'Remove social account',
'page callback' => 'culturefeed_ui_page_online_account_delete',
'page arguments' => array(3, 4, 5),
'access callback' => 'culturefeed_is_culturefeed_user',
@@ -82,8 +75,7 @@ function culturefeed_ui_menu() {
'file' => 'culturefeed_ui.pages.inc',
);
$items['culturefeed/onlineaccounts/privacy/%/%/%/%'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Configure privacy social account'),
+ 'title' => 'Configure privacy social account',
'page callback' => 'culturefeed_ui_page_online_account_update_privacy',
'page arguments' => array(3, 4, 5, 6),
'access callback' => 'culturefeed_is_culturefeed_user',
@@ -91,8 +83,7 @@ function culturefeed_ui_menu() {
'file' => 'culturefeed_ui.pages.inc',
);
$items['culturefeed/toggle/privacy/facebook/%/%/%'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Configure privacy social account'),
+ 'title' => 'Configure privacy social account',
'page callback' => 'culturefeed_ui_page_online_account_toggle_facebook_privacy',
'page arguments' => array(3, 4, 5, 6),
'access callback' => 'culturefeed_is_culturefeed_user',
@@ -100,8 +91,7 @@ function culturefeed_ui_menu() {
'file' => 'culturefeed_ui.pages.inc',
);
$items['culturefeed/users/mostactive'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Most active user'),
+ 'title' => 'Most active user',
'page callback' => 'culturefeed_ui_page_users_most_active',
'page arguments' => array(3),
'access arguments' => array('access content'),
@@ -109,8 +99,7 @@ function culturefeed_ui_menu() {
'file' => 'culturefeed_ui.pages.inc',
);
$items['culturefeed/removeaccount'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Delete account'),
+ 'title' => 'Delete account',
'page callback' => 'drupal_get_form',
'page arguments' => array('culturefeed_ui_page_remove_account_form'),
'access callback' => 'culturefeed_is_culturefeed_user',
@@ -149,10 +138,6 @@ function culturefeed_ui_init() {
}
}
-function culturefeed_ui_default_title_callback($title = '') {
- return $title;
-}
-
/**
* Implements hook_theme().
*/
From 3770fe3237c367d56eec5263d3c17c01a5aa2c97 Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Fri, 14 Nov 2014 10:11:51 +0100
Subject: [PATCH 15/67] Also change culturefeed_mailing to use correct way of
translating
---
.../culturefeed_mailing.module | 24 +++++++------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/culturefeed_mailing/culturefeed_mailing.module b/culturefeed_mailing/culturefeed_mailing.module
index 99819589..395bf2fc 100644
--- a/culturefeed_mailing/culturefeed_mailing.module
+++ b/culturefeed_mailing/culturefeed_mailing.module
@@ -30,8 +30,7 @@ function culturefeed_mailing_menu() {
$items = array();
$items['culturefeed/toggle/newsletter-optin/%/%/%'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array('Newsletter opt-in'),
+ 'title' => 'Newsletter opt-in',
'page callback' => 'culturefeed_mailing_toggle_optin',
'page arguments' => array(3, 4),
'access callback' => 'culturefeed_is_culturefeed_user',
@@ -75,8 +74,7 @@ function culturefeed_mailing_menu() {
// Content management pages.
$items['admin/content/mailing-lists'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array(t('Mailing lists')),
+ 'title' => 'Mailing lists',
'page callback' => 'culturefeed_mailing_lists_overview',
'access arguments' => array('manage mailing lists'),
'type' => MENU_LOCAL_TASK,
@@ -84,8 +82,7 @@ function culturefeed_mailing_menu() {
);
$items['admin/content/mailing-lists/add'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array(t('Add mailing list')),
+ 'title' => 'Add mailing list',
'page callback' => 'drupal_get_form',
'page arguments' => array('culturefeed_mailing_lists_form'),
'access arguments' => array('manage mailing lists'),
@@ -94,8 +91,7 @@ function culturefeed_mailing_menu() {
);
$items['admin/content/mailing-lists/edit/%culturefeed_mailing'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array(t('Add mailing list')),
+ 'title' => 'Add mailing list',
'page callback' => 'drupal_get_form',
'page arguments' => array('culturefeed_mailing_lists_form', 4),
'access arguments' => array('manage mailing lists'),
@@ -103,8 +99,7 @@ function culturefeed_mailing_menu() {
);
$items['admin/content/mailing-lists/test/%culturefeed_mailing'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array(t('Test mailing list')),
+ 'title' => 'Test mailing list',
'page callback' => 'drupal_get_form',
'page arguments' => array('culturefeed_mailing_test_list_form', 4),
'access arguments' => array('manage mailing lists'),
@@ -112,8 +107,7 @@ function culturefeed_mailing_menu() {
);
$items['admin/content/mailing-lists/send/%culturefeed_mailing'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array(t('Activate mailing list')),
+ 'title' => 'Activate mailing list',
'page callback' => 'drupal_get_form',
'page arguments' => array('culturefeed_mailing_send_list_form', 4),
'access arguments' => array('manage mailing lists'),
@@ -121,8 +115,7 @@ function culturefeed_mailing_menu() {
);
$items['admin/content/mailing-lists/disable/%culturefeed_mailing'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array(t('Disable scheduled sending')),
+ 'title' => 'Disable scheduled sending',
'page callback' => 'drupal_get_form',
'page arguments' => array('culturefeed_mailing_disable_list_form', 4),
'access arguments' => array('manage mailing lists'),
@@ -130,8 +123,7 @@ function culturefeed_mailing_menu() {
);
$items['admin/content/mailing-lists/delete/%culturefeed_mailing'] = array(
- 'title callback' => 'culturefeed_ui_default_title_callback',
- 'title arguments' => array(t('Add mailing list')),
+ 'title' => 'Add mailing list',
'page callback' => 'drupal_get_form',
'page arguments' => array('culturefeed_mailing_delete_form', 4),
'access arguments' => array('manage mailing lists'),
From 38d282d2f841ad12363b632337d1c78c699748a1 Mon Sep 17 00:00:00 2001
From: Luk Dens
Date: Fri, 14 Nov 2014 13:58:46 +0100
Subject: [PATCH 16/67] make embedded videos responsive
---
culturefeed_agenda/theme/theme.inc | 2 +-
culturefeed_search_ui/includes/helpers.inc | 13 ++++---------
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/culturefeed_agenda/theme/theme.inc b/culturefeed_agenda/theme/theme.inc
index 29523089..ae77f7b3 100644
--- a/culturefeed_agenda/theme/theme.inc
+++ b/culturefeed_agenda/theme/theme.inc
@@ -351,7 +351,7 @@ function _culturefeed_agenda_preprocess_agenda_detail(&$variables) {
$variables['videos'] = array();
$videos = $detail->getMedia()->byMediaType(CultureFeed_Cdb_Data_File::MEDIA_TYPE_VIDEO);
foreach ($videos as $video) {
- if ($video_embed = _culturefeed_search_ui_video_url_to_embed($video->getHLink(), 240, 180)) {
+ if ($video_embed = _culturefeed_search_ui_video_url_to_embed($video->getHLink())) {
$variables['videos'][] = $video_embed;
}
}
diff --git a/culturefeed_search_ui/includes/helpers.inc b/culturefeed_search_ui/includes/helpers.inc
index dc79eeb6..051cfdd0 100644
--- a/culturefeed_search_ui/includes/helpers.inc
+++ b/culturefeed_search_ui/includes/helpers.inc
@@ -7,7 +7,7 @@
/**
* Convert a given url to a youtube embed.
*/
-function _culturefeed_search_ui_video_url_to_embed($url, $width, $height) {
+function _culturefeed_search_ui_video_url_to_embed($url) {
// Construct embed url.
$embed_url = str_replace('watch', 'v', $url);
@@ -21,14 +21,9 @@ function _culturefeed_search_ui_video_url_to_embed($url, $width, $height) {
$embed_url .= '?fs=1&showinfo=0';
$embed = '';
- $embed .= '';
+ $embed .= '
';
+ $embed .= '';
+ $embed .= '
';
return $embed;
From 3a14dd2bc57dbd4215c5b2baf96f5d0cf120c42e Mon Sep 17 00:00:00 2001
From: Luk Dens
Date: Fri, 14 Nov 2014 14:58:26 +0100
Subject: [PATCH 17/67] remove 12 to 17 from default age range facet
---
culturefeed_search_ui/includes/blocks.inc | 6 ------
culturefeed_search_ui/includes/helpers.inc | 8 --------
2 files changed, 14 deletions(-)
diff --git a/culturefeed_search_ui/includes/blocks.inc b/culturefeed_search_ui/includes/blocks.inc
index 6141fe3c..01778169 100644
--- a/culturefeed_search_ui/includes/blocks.inc
+++ b/culturefeed_search_ui/includes/blocks.inc
@@ -470,12 +470,6 @@ function culturefeed_search_ui_block_age_range_facet() {
elseif ($age >= 9 && $age <= 11) {
$counts[9] += $item->getTotalResults();
}
- elseif ($age >= 12 && $age <= 14) {
- $counts[12] += $item->getTotalResults();
- }
- elseif ($age >= 15 && $age <= 17) {
- $counts[15] += $item->getTotalResults();
- }
}
// Create facet item for every count.
diff --git a/culturefeed_search_ui/includes/helpers.inc b/culturefeed_search_ui/includes/helpers.inc
index dc79eeb6..df7f791e 100644
--- a/culturefeed_search_ui/includes/helpers.inc
+++ b/culturefeed_search_ui/includes/helpers.inc
@@ -117,14 +117,6 @@ function culturefeed_search_ui_get_age_range_facet_options() {
'name' => '9-11 ' . t('year'),
'query' => '(agefrom:[9 TO 11])',
),
- 12 => array(
- 'name' => '12-14 ' . t('year'),
- 'query' => '(agefrom:[12 TO 14])',
- ),
- 15 => array(
- 'name' => '15-17 ' . t('year'),
- 'query' => '(agefrom:[15 TO 17])',
- ),
);
}
From 588fb810f54028e187282fee956a9b6f70479d76 Mon Sep 17 00:00:00 2001
From: Luk Dens
Date: Fri, 14 Nov 2014 15:00:04 +0100
Subject: [PATCH 18/67] add children events without specific min age to age
range filters
---
culturefeed_search_ui/includes/helpers.inc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/culturefeed_search_ui/includes/helpers.inc b/culturefeed_search_ui/includes/helpers.inc
index df7f791e..e9bc9584 100644
--- a/culturefeed_search_ui/includes/helpers.inc
+++ b/culturefeed_search_ui/includes/helpers.inc
@@ -103,19 +103,19 @@ function culturefeed_search_ui_get_age_range_facet_options() {
return array(
0 => array(
'name' => '0-2 ' . t('year'),
- 'query' => '(agefrom:[0 TO 2])',
+ 'query' => '(agefrom:[0 TO 2] OR keywords:"ook voor kinderen")',
),
3 => array(
'name' => '3-5 ' . t('year'),
- 'query' => '(agefrom:[3 TO 5])',
+ 'query' => '(agefrom:[3 TO 5] OR keywords:"ook voor kinderen")',
),
6 => array(
'name' => '6-8 ' . t('year'),
- 'query' => '(agefrom:[6 TO 8])',
+ 'query' => '(agefrom:[6 TO 8] OR keywords:"ook voor kinderen")',
),
9 => array(
'name' => '9-11 ' . t('year'),
- 'query' => '(agefrom:[9 TO 11])',
+ 'query' => '(agefrom:[9 TO 11] OR keywords:"ook voor kinderen")',
),
);
}
From 7a45f868fae987d5f79399f51e12625e99b2c575 Mon Sep 17 00:00:00 2001
From: Luk Dens
Date: Fri, 14 Nov 2014 19:57:41 +0100
Subject: [PATCH 19/67] add variable if event is suitable for kids
---
culturefeed_agenda/theme/theme.inc | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/culturefeed_agenda/theme/theme.inc b/culturefeed_agenda/theme/theme.inc
index ae77f7b3..df215715 100644
--- a/culturefeed_agenda/theme/theme.inc
+++ b/culturefeed_agenda/theme/theme.inc
@@ -325,6 +325,10 @@ function _culturefeed_agenda_preprocess_agenda(&$variables) {
$variables['keywords'] = '';
if ($keywords) {
$variables['keywords'] = implode(', ', $keywords);
+ // check if event is suitable for kids
+ if (array_key_exists('ook voor kinderen', $keywords)) {
+ $variables['forkids'] = TRUE;
+ }
}
}
@@ -389,6 +393,9 @@ function _culturefeed_agenda_preprocess_event(&$variables) {
$event_detail = $event->getDetails()->getDetailByLanguage(culturefeed_search_get_preferred_language());
$variables['agefrom'] = check_plain($event->getAgeFrom());
+ if ($event->getAgeFrom() && ($event->getAgeFrom() <= 12)) {
+ $variables['forkids'] = TRUE;
+ }
$variables['location'] = culturefeed_agenda_get_location_of_event($event);
$actor = NULL;
@@ -493,6 +500,9 @@ function _culturefeed_agenda_preprocess_production(&$variables) {
$organiser = $production->getOrganiser();
$variables['agefrom'] = $production->getAgeFrom();
+ if ($event->getAgeFrom() && ($event->getAgeFrom() <= 12)) {
+ $variables['forkids'] = TRUE;
+ }
$relations = $production->getRelations();
$total_relations = count($relations);
From ade3f384119be8a8fff051b34d0920950a22c21e Mon Sep 17 00:00:00 2001
From: Luk Dens
Date: Fri, 14 Nov 2014 20:09:54 +0100
Subject: [PATCH 20/67] variable forkids is true when agefrom = 0
---
culturefeed_agenda/theme/theme.inc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/culturefeed_agenda/theme/theme.inc b/culturefeed_agenda/theme/theme.inc
index df215715..2c3070ed 100644
--- a/culturefeed_agenda/theme/theme.inc
+++ b/culturefeed_agenda/theme/theme.inc
@@ -393,7 +393,7 @@ function _culturefeed_agenda_preprocess_event(&$variables) {
$event_detail = $event->getDetails()->getDetailByLanguage(culturefeed_search_get_preferred_language());
$variables['agefrom'] = check_plain($event->getAgeFrom());
- if ($event->getAgeFrom() && ($event->getAgeFrom() <= 12)) {
+ if (is_numeric($event->getAgeFrom()) && ($event->getAgeFrom() <= 12)) {
$variables['forkids'] = TRUE;
}
$variables['location'] = culturefeed_agenda_get_location_of_event($event);
@@ -500,7 +500,7 @@ function _culturefeed_agenda_preprocess_production(&$variables) {
$organiser = $production->getOrganiser();
$variables['agefrom'] = $production->getAgeFrom();
- if ($event->getAgeFrom() && ($event->getAgeFrom() <= 12)) {
+ if (is_numeric($event->getAgeFrom()) && ($event->getAgeFrom() <= 12)) {
$variables['forkids'] = TRUE;
}
From 274e2b266b1a9f9d7e85eaf8427272203ca8548c Mon Sep 17 00:00:00 2001
From: Luk Dens
Date: Fri, 14 Nov 2014 20:40:04 +0100
Subject: [PATCH 21/67] UIV-951 fix typo
---
culturefeed_agenda/theme/theme.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/culturefeed_agenda/theme/theme.inc b/culturefeed_agenda/theme/theme.inc
index 2c3070ed..95584953 100644
--- a/culturefeed_agenda/theme/theme.inc
+++ b/culturefeed_agenda/theme/theme.inc
@@ -500,7 +500,7 @@ function _culturefeed_agenda_preprocess_production(&$variables) {
$organiser = $production->getOrganiser();
$variables['agefrom'] = $production->getAgeFrom();
- if (is_numeric($event->getAgeFrom()) && ($event->getAgeFrom() <= 12)) {
+ if (is_numeric($production->getAgeFrom()) && ($production->getAgeFrom() <= 12)) {
$variables['forkids'] = TRUE;
}
From fd5f46f673a7a3f826ab897034d22864f1b9f3fe Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Mon, 17 Nov 2014 10:26:04 +0100
Subject: [PATCH 22/67] Revert commit 6b5942e403f5632e429aee9fc372298a21dcb303
(functionality removing validated admins)
---
culturefeed_pages/includes/members.inc | 64 ++++++--------------------
1 file changed, 13 insertions(+), 51 deletions(-)
diff --git a/culturefeed_pages/includes/members.inc b/culturefeed_pages/includes/members.inc
index ab78c668..c1e5338e 100644
--- a/culturefeed_pages/includes/members.inc
+++ b/culturefeed_pages/includes/members.inc
@@ -101,14 +101,7 @@ function culturefeed_pages_manage_members_list(CultureFeed_Cdb_Item_Page $page,
$row['function'] = $member->relation;
switch ($member->role) {
case CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN:
-
- if ($member->validated) {
- $role = t('validated administrator');
- }
- else {
- $role = t('administrator');
- }
-
+ $role = t('administrator');
break;
case CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_MEMBER:
default:
@@ -119,17 +112,11 @@ function culturefeed_pages_manage_members_list(CultureFeed_Cdb_Item_Page $page,
$row['member_since'] = date('d/m/Y H:i', $member->creationDate);
$row['edit'] = l(t('Edit'), 'pages/' . $page->getId() . '/membership/' . $member->user->id . '/edit/nojs', array('attributes' => array('class' => 'use-ajax')));
- if ($total_admins == 1 && !$member->validated && $member->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN) {
+ if ($total_admins == 1 && $member->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN) {
$row['delete'] = theme('culturefeed_pages_membership_delete_not_possible', array('page' => $page));
}
else {
- if ($member->validated) {
- $delete_label = t('Remove as validated administrator');
- }
- else {
- $delete_label = t('Remove as member');
- }
- $row['delete'] = l($delete_label, 'pages/' . $page->getId() . '/membership/' . $member->user->id . '/delete/nojs');
+ $row['delete'] = l(t('Remove as member'), 'pages/' . $page->getId() . '/membership/' . $member->user->id . '/delete/nojs');
}
}
// Show the edit form.
@@ -211,18 +198,10 @@ function culturefeed_pages_edit_membership_form($form, &$form_state, CultureFeed
// Only show toggle when user is not an admin, or he is not the only admin.
if ($membership->role != CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN || $total_admins != 1) {
-
- if ($membership->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_MEMBER) {
- $toggle_label = t('Make administrator');
- }
- else {
- $toggle_label = $membership->validated ? t('Remove administrator') : t('Remove validated administrator');
- }
-
$form['role'] = array(
'#type' => 'button',
'#name' => 'toggle_role',
- '#value' => $toggle_label,
+ '#value' => $membership->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN ? t('Remove administrator') : t('Make administrator'),
'#ajax' => array(
'callback' => 'culturefeed_pages_edit_membership_ajax_form_submit',
'wrapper' => 'membership-ajax-wrapper',
@@ -251,25 +230,16 @@ function culturefeed_pages_edit_membership_form_validate($form, &$form_state) {
$cf_pages = DrupalCultureFeed::getLoggedInUserInstance()->pages();
if ($form['#membership']->role == CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN) {
- // If he is a validated admin. Remove him as validated admin. He becomes a normal admin.
- if ($form['#membership']->validated) {
- $cf_pages->removeValidatedAdmin($form['#membership']->page->getId());
- $form_state['new_role'] = CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_ADMIN;
- }
- else {
+ $cf_pages->removeAdmin($form['#membership']->page->getId(), $form['#membership']->user->id);
- $cf_pages->removeAdmin($form['#membership']->page->getId(), $form['#membership']->user->id);
+ // If he was removed as admin, he is also removed as member. Re-add him as member.
+ $params = array(
+ 'relation' => $form['#membership']->relation,
+ 'activityPrivate' => FALSE,
+ );
- // If he was removed as admin, he is also removed as member. Re-add him as member.
- $params = array(
- 'relation' => $form['#membership']->relation,
- 'activityPrivate' => FALSE,
- );
-
- $cf_pages->addMember($form['#membership']->page->getId(), $form['#membership']->user->id, $params);
- $form_state['new_role'] = CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_MEMBER;
-
- }
+ $cf_pages->addMember($form['#membership']->page->getId(), $form['#membership']->user->id, $params);
+ $form_state['new_role'] = CultureFeed_Pages_Membership::MEMBERSHIP_ROLE_MEMBER;
}
else {
@@ -538,15 +508,7 @@ function culturefeed_pages_delete_member_form_validate($form, &$form_state) {
// Check if the user is admin or member.
if (culturefeed_pages_is_user_admin_of_page($form_state['page']->getId(), $form_state['user'])) {
-
- // If a validated admin is removed, he becomes a normal admin.
- if (culturefeed_pages_is_user_validated_admin_of_page($form_state['page']->getId(), $form_state['user'])) {
- DrupalCultureFeed::getLoggedInUserInstance()->pages()->removeValidatedAdmin($form_state['page']->getId());
- }
- else {
- DrupalCultureFeed::getLoggedInUserInstance()->pages()->removeAdmin($form_state['page']->getId(), $form_state['user']->id);
- }
-
+ DrupalCultureFeed::getLoggedInUserInstance()->pages()->removeAdmin($form_state['page']->getId(), $form_state['user']->id);
}
else {
DrupalCultureFeed::getLoggedInUserInstance()->pages()->removeMember($form_state['page']->getId(), $form_state['user']->id);
From feafab0d6aae5cedeb42775532477972c1cd6f0a Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Mon, 17 Nov 2014 17:44:22 +0100
Subject: [PATCH 23/67] Use correct status code for messages
---
culturefeed_pages/includes/members.inc | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/culturefeed_pages/includes/members.inc b/culturefeed_pages/includes/members.inc
index c1e5338e..887e7624 100644
--- a/culturefeed_pages/includes/members.inc
+++ b/culturefeed_pages/includes/members.inc
@@ -670,12 +670,14 @@ function culturefeed_pages_page_request_admin_membership_approved_submit($form,
function culturefeed_pages_page_request_validated_admin($page, $request_type) {
// Send request to become a validated admin.
+ $success = FALSE;
try {
$cf_pages = DrupalCultureFeed::getLoggedInUserInstance()->pages();
$cf_pages->addValidatedadmin($page->getId());
$message = t('Your request to become a validated administrator of this page is sent');
-
+ $success = TRUE;
+
}
catch (Exception $e) {
watchdog_exception('culturefeed_pages', $e);
@@ -692,7 +694,7 @@ function culturefeed_pages_page_request_validated_admin($page, $request_type) {
ajax_deliver(array('#type' => 'ajax', '#commands' => $commands));
}
else {
- drupal_set_message($message);
+ drupal_set_message($message, $success ? 'status': 'error');
drupal_goto();
}
From a55566131681221d7a6e813904ac48c0ef8c4b01 Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Tue, 18 Nov 2014 14:26:05 +0100
Subject: [PATCH 24/67] Translate the entity type facet items
---
culturefeed_agenda/includes/admin.inc | 6 +++---
culturefeed_search_ui/includes/blocks.inc | 9 ++++++++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/culturefeed_agenda/includes/admin.inc b/culturefeed_agenda/includes/admin.inc
index b9206736..064f402b 100644
--- a/culturefeed_agenda/includes/admin.inc
+++ b/culturefeed_agenda/includes/admin.inc
@@ -16,9 +16,9 @@ function culturefeed_agenda_admin_settings_form() {
'#title' => t('Entity types to be searched'),
'#type' => 'checkboxes',
'#options' => array(
- 'event' => t('Events'),
- 'production' => t('Productions'),
- 'actor' => t('Actors'),
+ 'event' => t('event', array(), array('context' => 'culturefeed-facets')),
+ 'production' => t('production', array(), array('context' => 'culturefeed-facets')),
+ 'actor' => t('actor', array(), array('context' => 'culturefeed-facets')),
),
'#default_value' => variable_get('culturefeed_agenda_active_entity_types', array('event', 'production')),
'#description' => t('Select the different entity types that can be shown on agenda/search'),
diff --git a/culturefeed_search_ui/includes/blocks.inc b/culturefeed_search_ui/includes/blocks.inc
index 791ef9a5..dcf930d4 100644
--- a/culturefeed_search_ui/includes/blocks.inc
+++ b/culturefeed_search_ui/includes/blocks.inc
@@ -119,10 +119,17 @@ function culturefeed_search_ui_search_facets_block($facet_name, $domain_id = '',
else {
$items = $facet->getResult()->getItems();
+ // type facet should go through t()
+ if ($facet_name == 'type') {
+ foreach ($items as $item) {
+ $item->setLabel(t($item->getLabel(), array(), array('context' => 'culturefeed-facets')));
+ }
+ }
// If the facet is one of the category facets. Translate the items.
- if (substr($facet_name, strlen($facet_name) - 3) == '_id') {
+ elseif (substr($facet_name, strlen($facet_name) - 3) == '_id') {
culturefeed_search_translate_facet($items);
}
+
}
if (!empty($items)) {
From 76e8844fef68339fd6dcd79f197dbb7601b4b0f9 Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Tue, 18 Nov 2014 17:51:36 +0100
Subject: [PATCH 25/67] Make sure type is not becoming category_id filter
---
culturefeed_agenda/lib/Drupal/AgendaSearchPage.php | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php b/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
index 41e43ef8..fe230e1a 100644
--- a/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
+++ b/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
@@ -37,13 +37,21 @@ public function initialize() {
$this->addQueryTerm(preg_replace("/\/\b|\b:/x", "", $params['search']));
}
- $this->addFacetFilters($params);
+ if (isset($params['facet']['type'])) {
+ $active_types = $params['facet']['type'];
+ unset($params['facet']['type']);
+ }
+ else {
+ $active_types = variable_get('culturefeed_agenda_active_entity_types', array('event', 'production'));
+ }
- $active_types = variable_get('culturefeed_agenda_active_entity_types', array('event', 'production'));
array_walk($active_types, function(&$active_type) {
$active_type = 'type:' . $active_type;
});
$this->parameters[] = new Parameter\FilterQuery(implode(' OR ', $active_types));
+
+ $this->addFacetFilters($params);
+
$this->parameters[] = $this->facetComponent->facetField('category');
$this->parameters[] = $this->facetComponent->facetField('datetype');
$this->parameters[] = $this->facetComponent->facetField('city');
From 7733e210f35b2e908063a92cd435f2ce71efeb7d Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Wed, 19 Nov 2014 11:57:31 +0100
Subject: [PATCH 26/67] Make sure no notice occurs
---
culturefeed_pages/includes/helpers.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/culturefeed_pages/includes/helpers.inc b/culturefeed_pages/includes/helpers.inc
index 0f9a7c93..3d46b3f0 100644
--- a/culturefeed_pages/includes/helpers.inc
+++ b/culturefeed_pages/includes/helpers.inc
@@ -508,6 +508,7 @@ function culturefeed_pages_get_validated_admins_of_page(CultureFeed_Cdb_Item_Pag
return array();
}
+ $admins_of_page = array();
foreach ($admin_list->memberships as $admin) {
if ($admin->validated) {
$admins_of_page[$admin->user->id] = $admin->user->id;
From 1990f9eeb6bf0baf1bc441edf4bee6b4671c56f7 Mon Sep 17 00:00:00 2001
From: Jochen Stals
Date: Wed, 19 Nov 2014 13:01:01 +0100
Subject: [PATCH 27/67] initial work for the location category id.
---
.../lib/Drupal/AgendaSearchPage.php | 14 +++++++++----
.../culturefeed_search_ui.module | 21 ++++++++++++++++++-
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php b/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
index c7b61538..bb923d05 100644
--- a/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
+++ b/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
@@ -43,6 +43,7 @@ public function initialize() {
$this->parameters[] = $this->facetComponent->facetField('category');
$this->parameters[] = $this->facetComponent->facetField('datetype');
$this->parameters[] = $this->facetComponent->facetField('city');
+ $this->parameters[] = $this->facetComponent->facetField('location_category_facility_id');
$this->execute($params);
@@ -181,8 +182,9 @@ private function translateFacets() {
$translated_terms = array();
$facets = $this->facetComponent->getFacets();
foreach ($facets as $key => $facet) {
- // The key should start with 'category_'
- if (substr($key, 0, 9) == 'category_') {
+ // The key should start with 'category_' or 'location_'
+ $start = substr($key, 0, 9);
+ if (in_array($start, array('category_', 'location_'))) {
$items = $facet->getResult()->getItems();
foreach ($items as $item) {
$found_ids[$item->getValue()] = $item->getValue();
@@ -198,12 +200,16 @@ private function translateFacets() {
// Translate the facets labels.
foreach ($facets as $key => $facet) {
- // The key should start with 'category_'
- if (substr($key, 0, 9) == 'category_') {
+ // The key should start with 'category_' or 'location_'
+ $start = substr($key, 0, 9);
+ if (in_array($start, array('category_', 'location_'))) {
$items = $facet->getResult()->getItems();
foreach ($items as $item) {
// Translate if found.
if (!empty($translations[$item->getValue()][$preferred_language])) {
+ if ($start == 'location_') {
+ dsm($translations[$item->getValue()][$preferred_language], $item->getLabel());
+ }
$item->setLabel($translations[$item->getValue()][$preferred_language]);
}
}
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index f237e069..7eb804cf 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -375,6 +375,7 @@ function culturefeed_search_ui_block_configure($delta) {
}
// Disable possible facet options.
+ // In fact this facility is named "location_category_facility_id" on events.
if ($delta == 'facet-facility') {
$options = culturefeed_search_get_categories_by_domain($delta_parts[1]);
@@ -716,12 +717,30 @@ function culturefeed_search_ui_block_view($delta) {
}
}
+ $facet_name = 'category_' . $delta_parts[1] . '_id';
+ $domain_id = $delta_parts[1];
+ $allowed_values = array();
+
+ // Hande "location_category_facility_id" as "facility".
+ if ($delta_parts[1] == 'facility') {
+ $delta = 'facility';
+ $facet_name = 'location_category_facility_id';
+ $domain_id = 'location_category_facility_id';
+ $enabled_options = variable_get('culturefeed_facet_enabled_options', NULL);
+ $allowed_values = culturefeed_search_get_categories_by_domain($delta_parts[1]);
+ foreach ($allowed_values as $key => $value) {
+ if (!isset($enabled_options[$delta][$key])) {
+ unset($allowed_values[$key]);
+ }
+ }
+ }
+
$block_settings = array(
'sort' => variable_get('culturefeed_search_sort_' . $delta, CULTUREFEED_SEARCH_SORT_ALPHABETICALLY),
'highest_level' => variable_get('culturefeed_facet_highest_level_' . $delta, 1),
'show_subitems' => variable_get('culturefeed_facet_show_subitems_' . $delta, FALSE),
);
- $block = culturefeed_search_ui_search_facets_block('category_' . $delta_parts[1] . '_id', $delta_parts[1], array(), $block_settings);
+ $block = culturefeed_search_ui_search_facets_block($facet_name, $domain_id, $allowed_values, $block_settings);
}
}
From 5d5f2810c71f174d254486f55cdf6ba36626955d Mon Sep 17 00:00:00 2001
From: Luk Dens
Date: Wed, 19 Nov 2014 15:08:11 +0100
Subject: [PATCH 28/67] UIV-965 show shortdescription as plain text
---
culturefeed_agenda/theme/theme.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/culturefeed_agenda/theme/theme.inc b/culturefeed_agenda/theme/theme.inc
index 95584953..7e9668d0 100644
--- a/culturefeed_agenda/theme/theme.inc
+++ b/culturefeed_agenda/theme/theme.inc
@@ -151,7 +151,7 @@ function _culturefeed_agenda_preprocess_agenda(&$variables) {
if ($detail) {
$variables['title'] = check_plain($detail->getTitle());
- $variables['shortdescription'] = $detail->getShortDescription();
+ $variables['shortdescription'] = check_plain($detail->getShortDescription());
$variables['longdescription'] = $detail->getLongDescription();
// Ad id / title to Drupal settings for easy reference in GTM.
From c72073dc0c3e500f27acc2f4b362c7964ba6ef26 Mon Sep 17 00:00:00 2001
From: Sven Houtmeyers
Date: Wed, 19 Nov 2014 17:15:39 +0100
Subject: [PATCH 29/67] fix typo in class name for adding tags
---
culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc
index 915689bf..04e0c843 100644
--- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc
+++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc
@@ -3032,7 +3032,7 @@ function culturefeed_entry_ui_edit_tags_form_submit($form, &$form_state) {
} catch (Exception $e) {
- if ($e->getCode() == culturefeed_entry_uiApi::CODE_KEYWORD_PRIVATE) {
+ if ($e->getCode() == CultureFeed_EntryApi::CODE_KEYWORD_PRIVATE) {
drupal_set_message(t('You tried to add a tag that should not be added by anyone. If you still wish to add this or have other questions about this, please email to "vragen@uitdatabank.be".'));
}
else {
From f9d60a68f53368a1c1109721d62b29c988ca0767 Mon Sep 17 00:00:00 2001
From: Sven Houtmeyers
Date: Wed, 19 Nov 2014 17:30:32 +0100
Subject: [PATCH 30/67] replace NULL as default for
culturefeed_search_ui_last_deletion_registration var - mail E2E
---
culturefeed_search_ui/culturefeed_search_ui.module | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index 39f8307b..641162a0 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -938,7 +938,7 @@ function culturefeed_search_ui_culturefeed_search_ui_active_filters($culturefeed
*/
function culturefeed_search_ui_register_deletions() {
- $last_registration_timestamp = variable_get('culturefeed_search_ui_last_deletion_registration', NULL);
+ $last_registration_timestamp = variable_get('culturefeed_search_ui_last_deletion_registration', REQUEST_TIME - (2629743 * 3));
if ($last_registration_timestamp) {
$last_registration = date('Y-m-d', $last_registration_timestamp);
}
From 44171f44c7cb8d95b67a6fc6c35b3550987ca6ba Mon Sep 17 00:00:00 2001
From: Jochen Stals
Date: Thu, 20 Nov 2014 11:29:27 +0100
Subject: [PATCH 31/67] Fixed the translateFacet
---
culturefeed_agenda/lib/Drupal/AgendaSearchPage.php | 3 ---
culturefeed_search_ui/culturefeed_search_ui.module | 1 +
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php b/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
index bb923d05..6c996fd4 100644
--- a/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
+++ b/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
@@ -207,9 +207,6 @@ private function translateFacets() {
foreach ($items as $item) {
// Translate if found.
if (!empty($translations[$item->getValue()][$preferred_language])) {
- if ($start == 'location_') {
- dsm($translations[$item->getValue()][$preferred_language], $item->getLabel());
- }
$item->setLabel($translations[$item->getValue()][$preferred_language]);
}
}
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index 7eb804cf..6520225a 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -733,6 +733,7 @@ function culturefeed_search_ui_block_view($delta) {
unset($allowed_values[$key]);
}
}
+ $allowed_values = drupal_map_assoc($allowed_values);
}
$block_settings = array(
From d6d702884d5b27c152e49456d5dbdb21b595d82a Mon Sep 17 00:00:00 2001
From: Jochen Stals
Date: Thu, 20 Nov 2014 14:49:31 +0100
Subject: [PATCH 32/67] finished UIT-3: created a way to have the allowed
options filtered.
---
.../culturefeed_search_ui.module | 20 ++++++----------
culturefeed_search_ui/includes/blocks.inc | 24 +++++++++++++++----
.../lib/Drupal/CultureFeedSearchPage.php | 3 +++
3 files changed, 29 insertions(+), 18 deletions(-)
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index 6520225a..9ab893c5 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -720,6 +720,11 @@ function culturefeed_search_ui_block_view($delta) {
$facet_name = 'category_' . $delta_parts[1] . '_id';
$domain_id = $delta_parts[1];
$allowed_values = array();
+ $block_settings = array(
+ 'sort' => variable_get('culturefeed_search_sort_' . $delta, CULTUREFEED_SEARCH_SORT_ALPHABETICALLY),
+ 'highest_level' => variable_get('culturefeed_facet_highest_level_' . $delta, 1),
+ 'show_subitems' => variable_get('culturefeed_facet_show_subitems_' . $delta, FALSE),
+ );
// Hande "location_category_facility_id" as "facility".
if ($delta_parts[1] == 'facility') {
@@ -727,20 +732,9 @@ function culturefeed_search_ui_block_view($delta) {
$facet_name = 'location_category_facility_id';
$domain_id = 'location_category_facility_id';
$enabled_options = variable_get('culturefeed_facet_enabled_options', NULL);
- $allowed_values = culturefeed_search_get_categories_by_domain($delta_parts[1]);
- foreach ($allowed_values as $key => $value) {
- if (!isset($enabled_options[$delta][$key])) {
- unset($allowed_values[$key]);
- }
- }
- $allowed_values = drupal_map_assoc($allowed_values);
+ $allowed_values = $enabled_options['facility'];
+ $block_settings['intersect'] = TRUE;
}
-
- $block_settings = array(
- 'sort' => variable_get('culturefeed_search_sort_' . $delta, CULTUREFEED_SEARCH_SORT_ALPHABETICALLY),
- 'highest_level' => variable_get('culturefeed_facet_highest_level_' . $delta, 1),
- 'show_subitems' => variable_get('culturefeed_facet_show_subitems_' . $delta, FALSE),
- );
$block = culturefeed_search_ui_search_facets_block($facet_name, $domain_id, $allowed_values, $block_settings);
}
diff --git a/culturefeed_search_ui/includes/blocks.inc b/culturefeed_search_ui/includes/blocks.inc
index 6141fe3c..53448b9d 100644
--- a/culturefeed_search_ui/includes/blocks.inc
+++ b/culturefeed_search_ui/includes/blocks.inc
@@ -89,6 +89,10 @@ function culturefeed_search_ui_search_block_form_submit($form, & $form_state) {
* List of allowed items, and the label that should be shown for every item.
* @param array $settings
* Array containing setting information (sort, highest level and subitems).
+ * $settings['intersect'] only works when $allowed_items is set. Intersect
+ * enabled will only use the options which were given.
+ * Intersect disabled will override the filter term labels. If you use this,
+ * make sure the given allowed items have the label as key as well.
*/
function culturefeed_search_ui_search_facets_block($facet_name, $domain_id = '', $allowed_items = array(), $settings = array()) {
@@ -105,14 +109,24 @@ function culturefeed_search_ui_search_facets_block($facet_name, $domain_id = '',
$facet = $facets[$facet_name];
- // Show only the allowed values, and set the requested label.
if (!empty($allowed_items)) {
$all_items = $facet->getResult()->getItems();
$items = array();
- foreach ($all_items as $item) {
- if (isset($allowed_items[$item->getLabel()]) && $item->getTotalResults() > 0) {
- $item->setLabel($allowed_items[$item->getLabel()]);
- $items[] = $item;
+ // Show only the allowed values, and set the requested label.
+ if (!isset($settings['intersect']) || !$settings['intersect']) {
+ foreach ($all_items as $item) {
+ if (isset($allowed_items[$item->getLabel()]) && $item->getTotalResults() > 0) {
+ $item->setLabel($allowed_items[$item->getLabel()]);
+ $items[] = $item;
+ }
+ }
+ }
+ // Show only the filtered allowed values.
+ else {
+ foreach ($all_items as $item) {
+ if (isset($allowed_items[$item->getValue()]) && $item->getTotalResults() > 0) {
+ $items[] = $item;
+ }
}
}
}
diff --git a/culturefeed_search_ui/lib/Drupal/CultureFeedSearchPage.php b/culturefeed_search_ui/lib/Drupal/CultureFeedSearchPage.php
index 720d8c0a..1707e994 100644
--- a/culturefeed_search_ui/lib/Drupal/CultureFeedSearchPage.php
+++ b/culturefeed_search_ui/lib/Drupal/CultureFeedSearchPage.php
@@ -458,6 +458,9 @@ protected function addFacetFilters($params) {
if ($facetFieldName == 'datetype') {
$facetFilterQuery = new Parameter\DateTypeQuery(implode(' OR ', $facetFilter));
}
+ elseif ($facetFieldName == 'location_category_facility_id') {
+ $facetFilterQuery = new Parameter\FilterQuery('location_category_facility_id:(' . implode(' OR ', $facetFilter) . ')');
+ }
else {
// If wreg we need to add reg (same id's, example 3000 Leuven wreg.638 reg.638)
From 5f20c008ea91a5d62ca86ed58f184e656077000b Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Thu, 20 Nov 2014 16:16:53 +0100
Subject: [PATCH 33/67] Use domain id for title
---
culturefeed_search_ui/culturefeed_search_ui.module | 1 -
1 file changed, 1 deletion(-)
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index 9ab893c5..427db48a 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -730,7 +730,6 @@ function culturefeed_search_ui_block_view($delta) {
if ($delta_parts[1] == 'facility') {
$delta = 'facility';
$facet_name = 'location_category_facility_id';
- $domain_id = 'location_category_facility_id';
$enabled_options = variable_get('culturefeed_facet_enabled_options', NULL);
$allowed_values = $enabled_options['facility'];
$block_settings['intersect'] = TRUE;
From 5a7a71e807325f2f846b36e3afe9ea252a1d349e Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Thu, 20 Nov 2014 17:29:24 +0100
Subject: [PATCH 34/67] Only add type when not all known types are selected
---
culturefeed_agenda/includes/admin.inc | 6 +---
culturefeed_agenda/includes/helpers.inc | 33 +++++++++++++------
.../lib/Drupal/AgendaSearchPage.php | 15 ++++++---
3 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/culturefeed_agenda/includes/admin.inc b/culturefeed_agenda/includes/admin.inc
index 064f402b..3b085dad 100644
--- a/culturefeed_agenda/includes/admin.inc
+++ b/culturefeed_agenda/includes/admin.inc
@@ -15,11 +15,7 @@ function culturefeed_agenda_admin_settings_form() {
$form['culturefeed_agenda_active_entity_types'] = array(
'#title' => t('Entity types to be searched'),
'#type' => 'checkboxes',
- '#options' => array(
- 'event' => t('event', array(), array('context' => 'culturefeed-facets')),
- 'production' => t('production', array(), array('context' => 'culturefeed-facets')),
- 'actor' => t('actor', array(), array('context' => 'culturefeed-facets')),
- ),
+ '#options' => culturefeed_agenda_known_entity_types(),
'#default_value' => variable_get('culturefeed_agenda_active_entity_types', array('event', 'production')),
'#description' => t('Select the different entity types that can be shown on agenda/search'),
);
diff --git a/culturefeed_agenda/includes/helpers.inc b/culturefeed_agenda/includes/helpers.inc
index 4c7262bc..32a636e6 100644
--- a/culturefeed_agenda/includes/helpers.inc
+++ b/culturefeed_agenda/includes/helpers.inc
@@ -4,6 +4,19 @@
* Helper functions for the culturefeed agenda.
**/
+/**
+ * Return all the known agenda entity types.
+ */
+function culturefeed_agenda_known_entity_types() {
+
+ return array(
+ 'event' => t('event', array(), array('context' => 'culturefeed-facets')),
+ 'production' => t('production', array(), array('context' => 'culturefeed-facets')),
+ 'actor' => t('actor', array(), array('context' => 'culturefeed-facets')),
+ );
+
+}
+
/**
* Get the current active agenda object.
* @param $path
@@ -260,7 +273,7 @@ function culturefeed_agenda_get_production_program_data_for_item(Cultuurnet\Sear
'city' => isset($location['city']) ? $location['city'] : '',
'venue' => isset($location['title']) ? $location['title'] : '',
);
-
+
// Extend with an url to the actor.
// This can be an organiser, or a location.
$organiser = $cdb_item->getOrganiser();
@@ -543,8 +556,8 @@ function culturefeed_agenda_load_events_of_production($production, $future_only
function culturefeed_agenda_parse_weekscheme(CultureFeed_Cdb_Data_Calendar_Weekscheme $weekscheme) {
$weekscheme_array = array();
-
- foreach ($weekscheme->getDays() as $day) {
+
+ foreach ($weekscheme->getDays() as $day) {
$weekscheme_array[$day->getDayName()] = array(
'type' => $day->getOpenType(),
);
@@ -602,14 +615,14 @@ function culturefeed_agenda_parse_timestamps($timestamps) {
}
function culturefeed_agenda_group_timestamps(&$timestamps) {
-
+
for ($i=0; $irewind();
if ($calendar_class == 'CultureFeed_Cdb_Data_Calendar_PeriodList') {
-
+
$calendar_array = array(
'type' => 'period',
'period_start' => $calendar->current()->getDateFrom(),
'period_end' => $calendar->current()->getDateTo(),
);
- if ($calendar->current()->getWeekScheme()) {
+ if ($calendar->current()->getWeekScheme()) {
$calendar_array['weekscheme'] = culturefeed_agenda_parse_weekscheme($calendar->current()->getWeekScheme());
}
if ($calendar->current()->getExceptions()) {
$calendar_array['exceptions'] = culturefeed_agenda_parse_timestamps($calendar->current()->getExceptions());
}
-
+
}
elseif ($calendar_class == 'CultureFeed_Cdb_Data_Calendar_Permanent') {
$calendar_array = array(
'type' => 'permanent',
);
-
+
if ($calendar->getWeekScheme()) {
$calendar_array['weekscheme'] = culturefeed_agenda_parse_weekscheme($calendar->getWeekScheme());
}
if ($calendar->getExceptions()) {
$calendar_array['exceptions'] = culturefeed_agenda_parse_timestamps($calendar->getExceptions());
}
-
+
}
elseif ($calendar_class == 'CultureFeed_Cdb_Data_Calendar_TimestampList') {
$calendar_array = array(
diff --git a/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php b/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
index fe230e1a..6e523903 100644
--- a/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
+++ b/culturefeed_agenda/lib/Drupal/AgendaSearchPage.php
@@ -37,18 +37,25 @@ public function initialize() {
$this->addQueryTerm(preg_replace("/\/\b|\b:/x", "", $params['search']));
}
+ $add_type_filter = TRUE;
if (isset($params['facet']['type'])) {
$active_types = $params['facet']['type'];
unset($params['facet']['type']);
}
else {
$active_types = variable_get('culturefeed_agenda_active_entity_types', array('event', 'production'));
+ // If all active types are selected, don't add filter.
+ if (count($active_types) == count(culturefeed_agenda_known_entity_types())) {
+ $add_type_filter = FALSE;
+ }
}
- array_walk($active_types, function(&$active_type) {
- $active_type = 'type:' . $active_type;
- });
- $this->parameters[] = new Parameter\FilterQuery(implode(' OR ', $active_types));
+ if ($add_type_filter) {
+ array_walk($active_types, function(&$active_type) {
+ $active_type = 'type:' . $active_type;
+ });
+ $this->parameters[] = new Parameter\FilterQuery(implode(' OR ', $active_types));
+ }
$this->addFacetFilters($params);
From 5f18f70b27bf8914362b48752ecbbdc7f30272bc Mon Sep 17 00:00:00 2001
From: Sven Houtmeyers
Date: Fri, 21 Nov 2014 11:23:51 +0100
Subject: [PATCH 35/67] CF-368 only register deletions in cron op production
api
---
culturefeed_search_ui/culturefeed_search_ui.module | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index 641162a0..b358367d 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -59,7 +59,12 @@ function culturefeed_search_ui_init() {
* Implements hook_cron().
*/
function culturefeed_search_ui_cron() {
- culturefeed_search_ui_register_deletions();
+
+ // Only register deletions on production api (otherwise to slow)
+ if (strpos(variable_get('culturefeed_search_api_location', CULTUREFEED_SEARCH_API_LOCATION) ,'www') !== false) {
+ culturefeed_search_ui_register_deletions();
+ }
+
}
/**
From bee8a2babc15292376908b39a4071768286c0dc8 Mon Sep 17 00:00:00 2001
From: Sven Houtmeyers
Date: Fri, 21 Nov 2014 12:08:41 +0100
Subject: [PATCH 36/67] UIV-957 fixing to many films
---
culturefeed_search_ui/culturefeed_search_ui.module | 5 +++++
culturefeed_search_ui/includes/helpers.inc | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index b358367d..1172200c 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -725,6 +725,11 @@ function culturefeed_search_ui_culturefeed_search_page_query_alter(CultureFeedSe
$culturefeedSearchPage->addParameter(new Parameter\FilterQuery($option['api-filter-query']));
}
}
+
+ // If group = event_production exclude productions (already included in group)
+ if ($culturefeedSearchPage->getGroup() == 'event_production') {
+ $culturefeedSearchPage->addParameter(new \Cultuurnet\Search\Parameter\FilterQuery('!type:production'));
+ }
// Add facet on agefrom.
$facet_component = culturefeed_get_facet_component();
diff --git a/culturefeed_search_ui/includes/helpers.inc b/culturefeed_search_ui/includes/helpers.inc
index 4eaae9ca..a6badcdb 100644
--- a/culturefeed_search_ui/includes/helpers.inc
+++ b/culturefeed_search_ui/includes/helpers.inc
@@ -304,7 +304,7 @@ function culturefeed_get_search_page($search_type) {
$pages[$class_name] = new $search_type['class_name']();
$pages[$class_name]->setResultsPerPage(variable_get('culturefeed_search_ui_pager_items_per_page', CULTUREFEED_SEARCH_UI_PAGER_ITEMS_PER_PAGE));
$pages[$class_name]->setDefaultSort($search_type['sort_default']);
- $pages[$class_name]->setGroup(variable_get('culturefeed_search_group', TRUE));
+ $pages[$class_name]->setGroup(variable_get('culturefeed_search_group', 'event_production'));
$pages[$class_name]->initialize();
}
return $pages[$class_name];
From 043b961c1521c1f8254acaaca1f06568f04708f2 Mon Sep 17 00:00:00 2001
From: zuuperman
Date: Mon, 24 Nov 2014 13:53:48 +0100
Subject: [PATCH 37/67] Don't show on nodes
---
culturefeed_social/culturefeed_social.module | 3 +++
1 file changed, 3 insertions(+)
diff --git a/culturefeed_social/culturefeed_social.module b/culturefeed_social/culturefeed_social.module
index 4a82b596..ffa8a526 100644
--- a/culturefeed_social/culturefeed_social.module
+++ b/culturefeed_social/culturefeed_social.module
@@ -517,6 +517,9 @@ function culturefeed_social_block_view($delta) {
case 'attended-by':
$object = culturefeed_search_get_active_object();
+ if (!$object || !method_exists($object, 'getType') || $object->getType() == 'node') {
+ return;
+ }
return culturefeed_social_user_list_block_for_activity($object, CultureFeed_Activity::TYPE_IK_GA);
case 'comments':
From 81ba717278388441acf47dada410cbbef565ea56 Mon Sep 17 00:00:00 2001
From: Lieven Goudeseune
Date: Wed, 26 Nov 2014 15:46:20 +0100
Subject: [PATCH 38/67] UIT-5: Actor search block.
---
culturefeed_agenda/culturefeed_agenda.module | 51 +++++++++++++-
culturefeed_agenda/includes/blocks.inc | 66 +++++++++++++++++++
culturefeed_agenda/includes/helpers.inc | 64 +++++++++++++++---
culturefeed_agenda/includes/pages.inc | 27 ++++++++
.../js/autocomplete_autosubmit.js | 36 ++++++++++
.../culturefeed-agenda-actors-nearby.tpl.php | 10 +++
culturefeed_agenda/theme/theme.inc | 19 ++++++
7 files changed, 262 insertions(+), 11 deletions(-)
create mode 100644 culturefeed_agenda/js/autocomplete_autosubmit.js
create mode 100644 culturefeed_agenda/theme/culturefeed-agenda-actors-nearby.tpl.php
diff --git a/culturefeed_agenda/culturefeed_agenda.module b/culturefeed_agenda/culturefeed_agenda.module
index ff0ff8dc..7ef9517a 100644
--- a/culturefeed_agenda/culturefeed_agenda.module
+++ b/culturefeed_agenda/culturefeed_agenda.module
@@ -90,6 +90,13 @@ function culturefeed_agenda_theme() {
'path' => $path,
);
+ $theme['culturefeed_agenda_actors_nearby'] = array(
+ 'variables' => array('items' => array()),
+ 'template' => 'culturefeed-agenda-actors-nearby',
+ 'path' => $path,
+ 'file' => 'theme.inc',
+ );
+
return $theme;
}
@@ -197,6 +204,14 @@ function culturefeed_agenda_menu() {
'file' => 'includes/pages.inc',
);
+ $items['autocomplete/culturefeed/agenda/actor-search'] = array(
+ 'page callback' => 'culturefeed_agenda_actor_search_autocomplete',
+ 'page arguments' => array(4, TRUE),
+ 'access arguments' => array('access content'),
+ 'type' => MENU_CALLBACK,
+ 'file' => 'includes/pages.inc',
+ );
+
return $items;
}
@@ -284,6 +299,11 @@ function culturefeed_agenda_block_info() {
'cache' => DRUPAL_CACHE_PER_PAGE,
);
+ $blocks['agenda-actor-search'] = array(
+ 'info' => t('Culturefeed agenda: actor search'),
+ 'cache' => DRUPAL_CACHE_PER_PAGE,
+ );
+
return $blocks;
}
@@ -358,6 +378,29 @@ function culturefeed_agenda_block_configure($delta) {
'#default_value' => variable_get('agenda_search_block_domain_id'),
);
+ }
+ elseif ($delta == 'agenda-actor-search') {
+
+ $options = culturefeed_search_get_actortype_categories();
+ asort($options);
+ $form['agenda_actor_search'] = array(
+ '#title' => t('Available actortype categories.'),
+ '#description' => t('Select the actortype categories that will be used to filter the autocomplete.'),
+ '#type' => 'checkboxes',
+ '#options' => $options,
+ '#default_value' => variable_get('agenda_actor_search'),
+ );
+
+ $visibility_options = culturefeed_search_get_categories_by_domain('eventtype');
+ asort($visibility_options);
+ $form['agenda_actor_search_visibility'] = array(
+ '#title' => t('Visibility settings.'),
+ '#description' => t('Select the eventtypes where tis block may be visible.'),
+ '#type' => 'checkboxes',
+ '#options' => $visibility_options,
+ '#default_value' => variable_get('agenda_actor_search_visibility'),
+ );
+
}
return $form;
@@ -380,6 +423,10 @@ function culturefeed_agenda_block_save($delta, $edit) {
elseif ($delta == 'agenda-search-block') {
variable_set('agenda_search_block_domain_id', $edit['agenda_search_block_domain_id']);
}
+ elseif ($delta == 'agenda-actor-search') {
+ variable_set('agenda_actor_search', $edit['agenda_actor_search']);
+ variable_set('agenda_actor_search_visibility', $edit['agenda_actor_search_visibility']);
+ }
}
@@ -406,6 +453,8 @@ function culturefeed_agenda_block_view($delta) {
case 'production-program':
return culturefeed_agenda_block_production_program();
+ case 'agenda-actor-search':
+ return culturefeed_agenda_block_actor_search_facet();
}
return $block;
@@ -429,7 +478,7 @@ function culturefeed_agenda_culturefeed_search_ui_active_filters($culturefeedFac
unset($search_query['actor']);
$url = url($path, array('query' => $search_query));
$build['nearby'] = array(
- '#theme' => 'culturefeed_search_active_filters_item',
+ '#theme' => 'cul turefeed_search_active_filters_item',
'#label' => check_plain($actor->getTitle(culturefeed_search_get_preferred_language())),
'#url' => $url,
);
diff --git a/culturefeed_agenda/includes/blocks.inc b/culturefeed_agenda/includes/blocks.inc
index 0a570f21..9ce76637 100644
--- a/culturefeed_agenda/includes/blocks.inc
+++ b/culturefeed_agenda/includes/blocks.inc
@@ -4,6 +4,8 @@
* Block callbacks for culturefeed agenda.
*/
+use \CultuurNet\Search\Parameter;
+
/**
* Block to show the related events from an item.
*/
@@ -246,3 +248,67 @@ function culturefeed_agenda_block_production_program() {
return $block;
}
+
+function culturefeed_agenda_block_actor_search_facet() {
+
+ // Only go if we're on an agenda search page.
+ if (current_path() != 'agenda/search') {
+ return;
+ }
+
+ // Only show this block if allowed in the block settings.
+ $current_event = $_GET['facet']['category_eventtype_id'][0];
+ $saved_events = variable_get('agenda_actor_search_visibility');
+ $allowed_events = array();
+
+ foreach ($saved_events as $saved_event) {
+ if ($saved_event != 0) {
+ $allowed_events[] = $saved_event;
+ }
+ }
+
+ if (!in_array($current_event, $allowed_events)) {
+ return;
+ }
+
+ // Create build array with actor search form and nearby actors.
+ $build = array();
+ $build['form'] = drupal_get_form('culturefeed_agenda_block_actor_search_form');
+ $build['actors_nearby'] = culturefeed_agenda_get_actors_nearby_for_event($current_event);
+
+ return array(
+ 'subject' => t('Actor'),
+ 'content' => $build,
+ );
+}
+
+/**
+ * Form callback to show the agenda actor search block.
+ */
+function culturefeed_agenda_block_actor_search_form($form, &$form_state) {
+ $form = array();
+
+ $form['#attached']['js'] = array(
+ array('data' => CULTUREFEED_GOOGLE_MAPS_JS_API, 'type' => 'external'),
+ drupal_get_path('module', 'culturefeed_agenda') . '/js/autocomplete_autosubmit.js',
+ );
+ $form['#attached']['library'] = array(
+ array('system', 'jquery.cookie'),
+ );
+
+ $form['search'] = array(
+ '#type' => 'textfield',
+ '#size' => 28,
+ '#title' => t('Search string'),
+ '#title_display' => 'invisible',
+ '#attributes' => array('class' => array('auto-submit-field'), 'placeholder' => t('Plaats of naam')),
+ '#autocomplete_path' => 'autocomplete/culturefeed/agenda/actor-search'
+ );
+
+ return $form;
+}
+
+
+
+
+
diff --git a/culturefeed_agenda/includes/helpers.inc b/culturefeed_agenda/includes/helpers.inc
index 4c7262bc..fb57c6d8 100644
--- a/culturefeed_agenda/includes/helpers.inc
+++ b/culturefeed_agenda/includes/helpers.inc
@@ -260,7 +260,7 @@ function culturefeed_agenda_get_production_program_data_for_item(Cultuurnet\Sear
'city' => isset($location['city']) ? $location['city'] : '',
'venue' => isset($location['title']) ? $location['title'] : '',
);
-
+
// Extend with an url to the actor.
// This can be an organiser, or a location.
$organiser = $cdb_item->getOrganiser();
@@ -543,8 +543,8 @@ function culturefeed_agenda_load_events_of_production($production, $future_only
function culturefeed_agenda_parse_weekscheme(CultureFeed_Cdb_Data_Calendar_Weekscheme $weekscheme) {
$weekscheme_array = array();
-
- foreach ($weekscheme->getDays() as $day) {
+
+ foreach ($weekscheme->getDays() as $day) {
$weekscheme_array[$day->getDayName()] = array(
'type' => $day->getOpenType(),
);
@@ -602,14 +602,14 @@ function culturefeed_agenda_parse_timestamps($timestamps) {
}
function culturefeed_agenda_group_timestamps(&$timestamps) {
-
+
for ($i=0; $irewind();
if ($calendar_class == 'CultureFeed_Cdb_Data_Calendar_PeriodList') {
-
+
$calendar_array = array(
'type' => 'period',
'period_start' => $calendar->current()->getDateFrom(),
'period_end' => $calendar->current()->getDateTo(),
);
- if ($calendar->current()->getWeekScheme()) {
+ if ($calendar->current()->getWeekScheme()) {
$calendar_array['weekscheme'] = culturefeed_agenda_parse_weekscheme($calendar->current()->getWeekScheme());
}
if ($calendar->current()->getExceptions()) {
$calendar_array['exceptions'] = culturefeed_agenda_parse_timestamps($calendar->current()->getExceptions());
}
-
+
}
elseif ($calendar_class == 'CultureFeed_Cdb_Data_Calendar_Permanent') {
$calendar_array = array(
'type' => 'permanent',
);
-
+
if ($calendar->getWeekScheme()) {
$calendar_array['weekscheme'] = culturefeed_agenda_parse_weekscheme($calendar->getWeekScheme());
}
if ($calendar->getExceptions()) {
$calendar_array['exceptions'] = culturefeed_agenda_parse_timestamps($calendar->getExceptions());
}
-
+
}
elseif ($calendar_class == 'CultureFeed_Cdb_Data_Calendar_TimestampList') {
$calendar_array = array(
@@ -669,4 +669,48 @@ function culturefeed_agenda_parse_calendar($calendar) {
$calendar_array['timestamps'] = culturefeed_agenda_group_timestamps($calendar_array['timestamps']);
}
return $calendar_array;
+}
+
+/**
+ * Function to search for 5 actors in the neighbourhood for a given eventtype.
+ * @param type $event
+ * The tid of the eventtype.
+ * @return string
+ * A string with html links.
+ */
+function culturefeed_agenda_get_actors_nearby_for_event($event) {
+
+ $type = db_query('SELECT slug FROM {culturefeed_search_terms} WHERE tid = :tid AND language = :language', array(':tid' => $event, ':language' => culturefeed_search_get_preferred_language()))->fetchField();
+ $coordinates = json_decode($_COOKIE['uitid_location']);
+ $point = new \CultuurNet\Search\Parameter\Spatial\Point($coordinates->latitude, $coordinates->longitude);
+ $distance = new \CultuurNet\Search\Parameter\Spatial\Distance(CULTUREFEED_SEARCH_DEFAULT_PROXIMITY_RANGE);
+ $field = new \CultuurNet\Search\Parameter\Spatial\SpatialField('physical_gis');
+ $parameters = array();
+ $parameters[] = new \CultuurNet\Search\Parameter\Spatial\GeoFilterQuery($point, $distance, $field);
+ $parameters[] = new \CultuurNet\Search\Parameter\Rows(5);
+ $parameters[] = new \CultuurNet\Search\Parameter\Query($type);
+ $parameters[] = new \CultuurNet\Search\Parameter\FilterQuery('type:actor');
+
+ try {
+
+ $result = culturefeed_get_search_service()->search($parameters);
+
+ if ($result->getTotalCount() == 0) {
+ return;
+ }
+
+ $items = $result->getItems();
+
+ }
+ catch (Exception $e) {
+ watchdog_exception('culturefeed_agenda', $e);
+ return;
+ }
+
+ $actors = array(
+ '#theme' => 'culturefeed_agenda_actors_nearby',
+ '#items' => $items,
+ );
+
+ return $actors;
}
\ No newline at end of file
diff --git a/culturefeed_agenda/includes/pages.inc b/culturefeed_agenda/includes/pages.inc
index 48ede33c..92ad60ee 100644
--- a/culturefeed_agenda/includes/pages.inc
+++ b/culturefeed_agenda/includes/pages.inc
@@ -219,3 +219,30 @@ function culturefeed_agenda_page_ajax_related_activities($cdb_id) {
ajax_deliver(array('#type' => 'ajax', '#commands' => $commands));
}
+
+function culturefeed_agenda_actor_search_autocomplete($search, $past) {
+
+ $matches = array();
+
+ if ($search) {
+
+ try {
+
+ // Get the list of suggestions from service.
+ $suggestions = culturefeed_get_search_service()->searchSuggestions($search, array('actor'), $past);
+ // @todo: only use suggestions for the actortypes saved in block configure.
+ if ($suggestions->hasSuggestions()) {
+ foreach ($suggestions as $suggestion) {
+ $path = culturefeed_search_detail_url('actor', $suggestion->getCdbid(), $suggestion->getTitle());
+ $matches[$path] = check_plain($suggestion->getTitle());
+ }
+ }
+
+ }
+ catch (ClientErrorResponseException $e) {
+ watchdog_exception('culturefeed_agenda', $e);
+ }
+
+ }
+ drupal_json_output($matches);
+}
diff --git a/culturefeed_agenda/js/autocomplete_autosubmit.js b/culturefeed_agenda/js/autocomplete_autosubmit.js
new file mode 100644
index 00000000..12a96ed9
--- /dev/null
+++ b/culturefeed_agenda/js/autocomplete_autosubmit.js
@@ -0,0 +1,36 @@
+(function ($) {
+
+ Drupal.jsAC.prototype.select = function (node) {
+
+ if($(this.input).hasClass('auto-submit-field')) {
+ window.location.href = $(node).data('autocompleteValue');
+ }
+ };
+
+ $(document).ready(function() {
+ if (navigator.geolocation) {
+
+ //if the browser supports geolocations get along and execute
+ navigator.geolocation.getCurrentPosition( function (position) {
+ //build up the querie for the google api
+ var geocoder = new google.maps.Geocoder();
+ var lat = parseFloat(position.coords.latitude);
+ var lng = parseFloat(position.coords.longitude);
+ var latlng = new google.maps.LatLng(lat, lng);
+
+ // execute the request and send the respons to addpostalcode function
+ geocoder.geocode({'latLng': latlng}, function (response) {
+
+ var location = {
+ latitude : response[0].geometry.location.lat(),
+ longitude : response[0].geometry.location.lng(),
+ }
+
+ $.cookie('uitid_location', JSON.stringify(location));
+ });
+ });
+
+ }
+ })
+
+})(jQuery);
diff --git a/culturefeed_agenda/theme/culturefeed-agenda-actors-nearby.tpl.php b/culturefeed_agenda/theme/culturefeed-agenda-actors-nearby.tpl.php
new file mode 100644
index 00000000..8b6b28ee
--- /dev/null
+++ b/culturefeed_agenda/theme/culturefeed-agenda-actors-nearby.tpl.php
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/culturefeed_agenda/theme/theme.inc b/culturefeed_agenda/theme/theme.inc
index 7e9668d0..55d3176a 100644
--- a/culturefeed_agenda/theme/theme.inc
+++ b/culturefeed_agenda/theme/theme.inc
@@ -895,3 +895,22 @@ function culturefeed_agenda_preprocess_culturefeed_agenda_de_lijn_widget(&$varia
drupal_add_js(array('delijn' => $settings), 'setting');
}
+
+/**
+ * Preprocess the agenda nearby actor search.
+ */
+function culturefeed_agenda_preprocess_culturefeed_agenda_actors_nearby(&$variables) {
+
+ //Create link for each actor.
+ $actors = array();
+
+ foreach ($variables['items'] as $item) {
+ $title = $item->getTitle(culturefeed_search_get_preferred_language());
+ $id = $item->getId();
+ $url = culturefeed_search_detail_url('actor', $id, $title);
+ $actors[] = l($title, $GLOBALS['base_url'] . $url);
+ }
+
+ $variables['links'] = implode(', ', $actors);
+
+}
From 8344095876a3f3434662ac49b3fdd474fdf80c9f Mon Sep 17 00:00:00 2001
From: Lieven Goudeseune
Date: Wed, 26 Nov 2014 17:11:03 +0100
Subject: [PATCH 39/67] UIT-11: Skip disabled terms in termImport().
---
.../lib/Drupal/Import/CultureFeedDomainImport.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/culturefeed_search/lib/Drupal/Import/CultureFeedDomainImport.php b/culturefeed_search/lib/Drupal/Import/CultureFeedDomainImport.php
index 29f4e787..633f2c89 100644
--- a/culturefeed_search/lib/Drupal/Import/CultureFeedDomainImport.php
+++ b/culturefeed_search/lib/Drupal/Import/CultureFeedDomainImport.php
@@ -87,6 +87,12 @@ private function importTerms($TermsElement, $pids = array()) {
$termAttributes = $term->attributes();
+ // Do not import disabled terms
+ if ($termAttributes['enabled'] == 'false') {
+ drush_log('skipped disabled term: ' . $termAttributes['id'], 'warning');
+ continue;
+ }
+
// If it has children, also import them.
if (isset($term->term)) {
$child_pids = $pids;
From d47f8abe7a04c0051c17dbf1bdf69f3c8d0ca846 Mon Sep 17 00:00:00 2001
From: Lieven Goudeseune
Date: Thu, 27 Nov 2014 13:42:43 +0100
Subject: [PATCH 40/67] UIT-18: Move sort settings from block settings to admin
settings, Make sure default sorting is visible in sorting block.
---
culturefeed_agenda/includes/blocks.inc | 2 +-
.../culturefeed_search_ui.module | 126 +++---------------
culturefeed_search_ui/includes/admin.inc | 112 ++++++++++++++++
culturefeed_search_ui/theme/theme.inc | 5 +-
4 files changed, 137 insertions(+), 108 deletions(-)
diff --git a/culturefeed_agenda/includes/blocks.inc b/culturefeed_agenda/includes/blocks.inc
index 9ce76637..f4e9c859 100644
--- a/culturefeed_agenda/includes/blocks.inc
+++ b/culturefeed_agenda/includes/blocks.inc
@@ -257,7 +257,7 @@ function culturefeed_agenda_block_actor_search_facet() {
}
// Only show this block if allowed in the block settings.
- $current_event = $_GET['facet']['category_eventtype_id'][0];
+ $current_event = isset($_GET['facet']['category_eventtype_id'][0]) ? $_GET['facet']['category_eventtype_id'][0] : '';
$saved_events = variable_get('agenda_actor_search_visibility');
$allowed_events = array();
diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module
index bb0ee210..70f60529 100644
--- a/culturefeed_search_ui/culturefeed_search_ui.module
+++ b/culturefeed_search_ui/culturefeed_search_ui.module
@@ -59,12 +59,12 @@ function culturefeed_search_ui_init() {
* Implements hook_cron().
*/
function culturefeed_search_ui_cron() {
-
+
// Only register deletions on production api (otherwise to slow)
if (strpos(variable_get('culturefeed_search_api_location', CULTUREFEED_SEARCH_API_LOCATION) ,'www') !== false) {
culturefeed_search_ui_register_deletions();
}
-
+
}
/**
@@ -114,13 +114,30 @@ function culturefeed_search_ui_menu() {
$items['admin/config/culturefeed/search-ui'] = array(
'title' => 'CultureFeed Search UI',
- 'description' => t('Change CultureFeed Search UI settings like display, filters, …'),
+ 'description' => t('CultureFeed Search UI settings'),
'page callback' => 'drupal_get_form',
'page arguments' => array('culturefeed_search_ui_admin_settings'),
'access arguments' => array('administer site configuration'),
'file' => 'includes/admin.inc',
);
+ $items['admin/config/culturefeed/search-ui/general'] = array(
+ 'title' => 'General settings',
+ 'description' => t('Change CultureFeed Search UI settings like display, filters, …'),
+ 'access arguments' => array('administer site configuration'),
+ 'type' => MENU_DEFAULT_LOCAL_TASK,
+ );
+
+ $items['admin/config/culturefeed/search-ui/sort'] = array(
+ 'title' => 'Sort settings',
+ 'description' => t('Change CultureFeed Search UI sort settings.'),
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('culturefeed_search_ui_admin_sort_order_settings_form'),
+ 'access arguments' => array('administer site configuration'),
+ 'file' => 'includes/admin.inc',
+ 'type' => MENU_LOCAL_TASK,
+ );
+
$items['autocomplete/culturefeed_ui/city-region-suggestion'] = array(
'page callback' => 'culturefeed_search_ui_city_suggestion_autocomplete_page',
'page arguments' => array(3, TRUE),
@@ -502,79 +519,6 @@ function culturefeed_search_ui_block_configure($delta) {
}
- elseif ($delta == 'culturefeed-search-sortorder') {
-
- $form['description'] = array(
- '#markup' => t('
- Define the different sorting options you want.
- When a sorting option is not exposed. It won\'t be shown as option, but is applicable through the url.
- Example:
+ Define the different sorting options you want.
+ When a sorting option is not exposed. It won\'t be shown as option, but is applicable through the url.
+ Example: