From 243bd0aadad3017b8b62e18dff593e664f54694f Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Tue, 9 Dec 2014 09:19:25 +0100 Subject: [PATCH 001/275] CF-370 adding checkpermission --- lib/Drupal/DrupalCultureFeed_EntryApi.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Drupal/DrupalCultureFeed_EntryApi.php b/lib/Drupal/DrupalCultureFeed_EntryApi.php index 3e145b10..9b7eade1 100644 --- a/lib/Drupal/DrupalCultureFeed_EntryApi.php +++ b/lib/Drupal/DrupalCultureFeed_EntryApi.php @@ -230,5 +230,12 @@ public static function addTranslationToActor(CultureFeed_Cdb_Item_Actor $actor, public static function removeTranslationFromActor(CultureFeed_Cdb_Item_Actor $actor, $lang) { self::getLoggedInUserInstance()->removeTranslationFromActor($actor, $lang); } + + /** + * @see CultureFeed_EntryApi::checkPermission() + */ + public static function checkPermission($userid, $email, $ids) { + self::getLoggedInUserInstance()->checkPermission($userid, $email, $ids); + } } \ No newline at end of file From b2bb994da5b24697bed92afc5b7707b8450338ac Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Tue, 9 Dec 2014 15:09:10 +0100 Subject: [PATCH 002/275] CF-371 adding custom tags settings to cfe --- .../includes/culturefeed_entry_ui.admin.inc | 9 ++++++++- .../includes/culturefeed_entry_ui.pages.inc | 19 ++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.admin.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.admin.inc index 732a656b..e8182d47 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.admin.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.admin.inc @@ -27,10 +27,17 @@ function culturefeed_entry_ui_settings_form($form, &$form_state) { $form['culturefeed_entry_ui_custom_tags'] = array( '#type' => 'textarea', - '#title' => t('Custom tags'), + '#title' => t('Custom options on the /tags page'), '#default_value' => variable_get('culturefeed_entry_ui_custom_tags'), '#description' => t('Custom tags specific for this site. Use a new line for each tag.'), ); + + $form['culturefeed_entry_ui_custom_entry_api_tags'] = array( + '#type' => 'textarea', + '#title' => t('Custom tags to push to entry API'), + '#default_value' => variable_get('culturefeed_entry_ui_custom_entry_api_tags'), + '#description' => t('Tags pushed under the hood to Entry API. Use a new line for each tag.'), + ); return system_settings_form($form); diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 3594888c..9225dd2a 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -744,7 +744,7 @@ function culturefeed_entry_ui_event_form($form, $form_state, $event = NULL) { ); } - // Tags todo + // Tags $form['extra']['keywords'] = array( '#type' => 'textfield', '#title' => t('Tags'), @@ -2249,14 +2249,19 @@ function _culturefeed_entry_ui_ui_event_form_save_event($form, &$form_state, Cul $event->setContactInfo($contact_object); // Keywords. - if ($values['keywords']) { - $keywords = explode(';', $values['keywords']); - foreach ($keywords as $keyword) { - $event->addKeyword($keyword); - } + $keywords_form = array(); + if ($values['keywords']) { + $keywords_form = explode(';', $values['keywords']); + } + if (variable_get('culturefeed_entry_ui_custom_entry_api_tags')) { + $custom_entry_api_tags = explode("\n", variable_get('culturefeed_entry_ui_custom_entry_api_tags')); + } + $keywords = array_map('trim',array_unique(array_merge($keywords_form,$custom_entry_api_tags))); + foreach ($keywords as $keyword) { + $event->addKeyword($keyword); } - // Members + // Members. if ($values['members']) { $event->setPrivate(TRUE); } From 5b4a7f10abde00e64ba1339f7d2918eb717895d7 Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Wed, 10 Dec 2014 15:11:14 +0100 Subject: [PATCH 003/275] CF-370 adding checkpermission method --- lib/Drupal/DrupalCultureFeed_EntryApi.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Drupal/DrupalCultureFeed_EntryApi.php b/lib/Drupal/DrupalCultureFeed_EntryApi.php index 9b7eade1..bedabbe4 100644 --- a/lib/Drupal/DrupalCultureFeed_EntryApi.php +++ b/lib/Drupal/DrupalCultureFeed_EntryApi.php @@ -235,7 +235,12 @@ public static function removeTranslationFromActor(CultureFeed_Cdb_Item_Actor $ac * @see CultureFeed_EntryApi::checkPermission() */ public static function checkPermission($userid, $email, $ids) { - self::getLoggedInUserInstance()->checkPermission($userid, $email, $ids); + $permissions = json_decode( json_encode(self::getLoggedInUserInstance()->checkPermission($userid, $email, $ids)) , 1); + $parsed_permissons = array(); + foreach ($permissions['event'] as $permission) { + $parsed_permissons[$permission['cdbid']] = $permission['editable']; + } + return $parsed_permissons; } } \ No newline at end of file From 360f31df5af4da1dc865a762c12b86c4cdb0dd95 Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Thu, 11 Dec 2014 14:44:00 +0100 Subject: [PATCH 004/275] CF-370 adding edit view --- .../culturefeed_entry_ui.views_default.inc | 95 ++++++++++++++----- ...iews_handler_field_cdb_item_operations.inc | 21 +++- lib/Drupal/DrupalCultureFeed_EntryApi.php | 11 ++- 3 files changed, 96 insertions(+), 31 deletions(-) diff --git a/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc b/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc index 2461ffb2..22803df4 100644 --- a/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc +++ b/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc @@ -7,36 +7,41 @@ * Implements hook_views_default_views(). */ function culturefeed_entry_ui_views_default_views() { - $views = array(); $view = new view(); $view->name = 'culturefeed_events_createdbycurrentuser'; $view->description = ''; $view->tag = 'default'; $view->base_table = 'cdb_items'; - $view->human_name = 'CultureFeed events created by current user'; + $view->human_name = 'CultureFeed edit events'; $view->core = 7; $view->api_version = '3.0'; $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ - + /* Display: Master */ $handler = $view->new_display('default', 'Master', 'default'); $handler->display->display_options['title'] = 'Events created by me'; $handler->display->display_options['use_more_always'] = FALSE; + $handler->display->display_options['use_more_text'] = 'meer'; $handler->display->display_options['access']['type'] = 'perm'; $handler->display->display_options['access']['perm'] = 'create culturefeed events'; $handler->display->display_options['cache']['type'] = 'none'; $handler->display->display_options['query']['type'] = 'views_query'; $handler->display->display_options['exposed_form']['type'] = 'basic'; + $handler->display->display_options['exposed_form']['options']['submit_button'] = 'Toepassen'; + $handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Opnieuw instellen'; + $handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Sorteren op'; + $handler->display->display_options['exposed_form']['options']['sort_asc_label'] = 'Oplopend'; + $handler->display->display_options['exposed_form']['options']['sort_desc_label'] = 'Aflopend'; $handler->display->display_options['pager']['type'] = 'none'; $handler->display->display_options['style_plugin'] = 'default'; $handler->display->display_options['row_plugin'] = 'fields'; - /* Header: UDB items: Create event */ + /* Kop: Cdb items: Maak activiteit aan */ $handler->display->display_options['header']['create']['id'] = 'create'; $handler->display->display_options['header']['create']['table'] = 'cdb_items'; $handler->display->display_options['header']['create']['field'] = 'create'; $handler->display->display_options['header']['create']['empty'] = TRUE; - /* No results behavior: Global: Text area */ + /* Gedrag bij ontbreken van resultaten: Algemeen: Tekstveld */ $handler->display->display_options['empty']['area']['id'] = 'area'; $handler->display->display_options['empty']['area']['table'] = 'views'; $handler->display->display_options['empty']['area']['field'] = 'area'; @@ -44,14 +49,14 @@ function culturefeed_entry_ui_views_default_views() { $handler->display->display_options['empty']['area']['empty'] = TRUE; $handler->display->display_options['empty']['area']['content'] = 'Unable to find any events created by you.'; $handler->display->display_options['empty']['area']['format'] = 'filtered_html'; - /* Field: UDB items: Titel */ + /* Veld: Cdb items: Titel */ $handler->display->display_options['fields']['title']['id'] = 'title'; $handler->display->display_options['fields']['title']['table'] = 'cdb_items'; $handler->display->display_options['fields']['title']['field'] = 'title'; $handler->display->display_options['fields']['title']['label'] = ''; $handler->display->display_options['fields']['title']['element_label_colon'] = FALSE; $handler->display->display_options['fields']['title']['link'] = 1; - /* Field: UDB items: Afbeelding */ + /* Veld: Cdb items: Afbeelding */ $handler->display->display_options['fields']['picture']['id'] = 'picture'; $handler->display->display_options['fields']['picture']['table'] = 'cdb_items'; $handler->display->display_options['fields']['picture']['field'] = 'picture'; @@ -60,13 +65,13 @@ function culturefeed_entry_ui_views_default_views() { $handler->display->display_options['fields']['picture']['width'] = '100'; $handler->display->display_options['fields']['picture']['height'] = '100'; $handler->display->display_options['fields']['picture']['link'] = 1; - /* Field: UDB items: Short Description */ + /* Veld: Cdb items: Short Description */ $handler->display->display_options['fields']['description']['id'] = 'description'; $handler->display->display_options['fields']['description']['table'] = 'cdb_items'; $handler->display->display_options['fields']['description']['field'] = 'description'; $handler->display->display_options['fields']['description']['label'] = ''; $handler->display->display_options['fields']['description']['element_label_colon'] = FALSE; - /* Field: UDB items: Locatie */ + /* Veld: Cdb items: Locatie */ $handler->display->display_options['fields']['location']['id'] = 'location'; $handler->display->display_options['fields']['location']['table'] = 'cdb_items'; $handler->display->display_options['fields']['location']['field'] = 'location'; @@ -77,29 +82,29 @@ function culturefeed_entry_ui_views_default_views() { 'title' => 0, 'address' => 0, ); - /* Field: UDB items: Kalendersamenvatting */ + /* Veld: Cdb items: Calendar summary */ $handler->display->display_options['fields']['when']['id'] = 'when'; $handler->display->display_options['fields']['when']['table'] = 'cdb_items'; $handler->display->display_options['fields']['when']['field'] = 'when'; $handler->display->display_options['fields']['when']['label'] = ''; $handler->display->display_options['fields']['when']['element_label_colon'] = FALSE; - /* Field: UDB items: Last updated */ + /* Veld: Cdb items: Laatst bijgewerkt */ $handler->display->display_options['fields']['lastupdated']['id'] = 'lastupdated'; $handler->display->display_options['fields']['lastupdated']['table'] = 'cdb_items'; $handler->display->display_options['fields']['lastupdated']['field'] = 'lastupdated'; $handler->display->display_options['fields']['lastupdated']['date_format'] = 'short'; - /* Field: UDB items: Operations */ + /* Veld: Cdb items: Bewerkingen */ $handler->display->display_options['fields']['operations']['id'] = 'operations'; $handler->display->display_options['fields']['operations']['table'] = 'cdb_items'; $handler->display->display_options['fields']['operations']['field'] = 'operations'; $handler->display->display_options['fields']['operations']['label'] = ''; $handler->display->display_options['fields']['operations']['element_label_colon'] = FALSE; - /* Sort criterion: Cdb items: Last updated */ + /* Sorteercriterium: Cdb items: Laatst bijgewerkt */ $handler->display->display_options['sorts']['lastupdated']['id'] = 'lastupdated'; $handler->display->display_options['sorts']['lastupdated']['table'] = 'cdb_items'; $handler->display->display_options['sorts']['lastupdated']['field'] = 'lastupdated'; $handler->display->display_options['sorts']['lastupdated']['order'] = 'DESC'; - /* Filter criterion: UDB items: Type */ + /* Filtercriterium: Cdb items: Type */ $handler->display->display_options['filters']['type']['id'] = 'type'; $handler->display->display_options['filters']['type']['table'] = 'cdb_items'; $handler->display->display_options['filters']['type']['field'] = 'type'; @@ -107,26 +112,70 @@ function culturefeed_entry_ui_views_default_views() { 'event' => 'event', ); $handler->display->display_options['filters']['type']['group'] = 1; - /* Filter criterion: UDB items: Created by current user */ + /* Filtercriterium: Cdb items: Created by current user */ $handler->display->display_options['filters']['createdbycurrentuser']['id'] = 'createdbycurrentuser'; $handler->display->display_options['filters']['createdbycurrentuser']['table'] = 'cdb_items'; $handler->display->display_options['filters']['createdbycurrentuser']['field'] = 'createdbycurrentuser'; - + $handler->display->display_options['filters']['createdbycurrentuser']['exposed'] = TRUE; + $handler->display->display_options['filters']['createdbycurrentuser']['expose']['operator_id'] = 'createdbycurrentuser_op'; + $handler->display->display_options['filters']['createdbycurrentuser']['expose']['label'] = 'Created by current user'; + $handler->display->display_options['filters']['createdbycurrentuser']['expose']['operator'] = 'createdbycurrentuser_op'; + $handler->display->display_options['filters']['createdbycurrentuser']['expose']['identifier'] = 'createdbycurrentuser'; + /* Display: Block */ $handler = $view->new_display('block', 'Block', 'block'); + + /* Display: Pagina */ + $handler = $view->new_display('page', 'Pagina', 'page_1'); + $handler->display->display_options['defaults']['title'] = FALSE; + $handler->display->display_options['title'] = 'Edit events'; + $handler->display->display_options['defaults']['pager'] = FALSE; + $handler->display->display_options['pager']['type'] = 'full'; + $handler->display->display_options['pager']['options']['items_per_page'] = '10'; + $handler->display->display_options['pager']['options']['offset'] = '0'; + $handler->display->display_options['pager']['options']['id'] = '0'; + $handler->display->display_options['pager']['options']['quantity'] = '9'; + $handler->display->display_options['pager']['options']['expose']['items_per_page_label'] = 'Items per pagina'; + $handler->display->display_options['pager']['options']['expose']['items_per_page_options_all_label'] = '- Alle -'; + $handler->display->display_options['pager']['options']['expose']['offset_label'] = 'Startpunt'; + $handler->display->display_options['pager']['options']['tags']['first'] = '« eerste'; + $handler->display->display_options['pager']['options']['tags']['previous'] = '‹ vorige'; + $handler->display->display_options['pager']['options']['tags']['next'] = 'volgende ›'; + $handler->display->display_options['pager']['options']['tags']['last'] = 'laatste »'; + $handler->display->display_options['defaults']['filter_groups'] = FALSE; + $handler->display->display_options['defaults']['filters'] = FALSE; + /* Filtercriterium: Cdb items: Type */ + $handler->display->display_options['filters']['type']['id'] = 'type'; + $handler->display->display_options['filters']['type']['table'] = 'cdb_items'; + $handler->display->display_options['filters']['type']['field'] = 'type'; + $handler->display->display_options['filters']['type']['value'] = array( + 'event' => 'event', + ); + $handler->display->display_options['filters']['type']['group'] = 1; + $handler->display->display_options['path'] = 'agenda/edit'; $translatables['culturefeed_events_createdbycurrentuser'] = array( t('Master'), t('Events created by me'), - t('more'), - t('Apply'), - t('Reset'), - t('Sort by'), - t('Asc'), - t('Desc'), + t('meer'), + t('Toepassen'), + t('Opnieuw instellen'), + t('Sorteren op'), + t('Oplopend'), + t('Aflopend'), t('Notification that no results were found'), t('Unable to find any events created by you.'), - t('Last updated'), + t('Laatst bijgewerkt'), + t('Created by current user'), t('Block'), + t('Pagina'), + t('Edit events'), + t('Items per pagina'), + t('- Alle -'), + t('Startpunt'), + t('« eerste'), + t('‹ vorige'), + t('volgende ›'), + t('laatste »'), ); $views[$view->name] = $view; diff --git a/culturefeed_entry_ui/views/handlers/views_handler_field_cdb_item_operations.inc b/culturefeed_entry_ui/views/handlers/views_handler_field_cdb_item_operations.inc index c1100033..3cfb7df2 100644 --- a/culturefeed_entry_ui/views/handlers/views_handler_field_cdb_item_operations.inc +++ b/culturefeed_entry_ui/views/handlers/views_handler_field_cdb_item_operations.inc @@ -33,13 +33,24 @@ class views_handler_field_cdb_item_operations extends views_handler_field { 'title' => t('Delete'), ) ); - - foreach ($ops as $op => $op_details) { - $path = culturefeed_entry_ui_entity_path($extended_entity, $op); - if ($path && user_access($op_details['permission'])) { - $links[$op] = l($op_details['title'], $path); + + + + $user = $cf_account = DrupalCultureFeed::getLoggedInUser(); + + $ubd_permission = Drupalculturefeed_EntryApi::checkPermission($user->id, $user->mbox, array('ids' => $extended_entity->getId())); + + if ($ubd_permission[$extended_entity->getId()] == 'true') { + foreach ($ops as $op => $op_details) { + $path = culturefeed_entry_ui_entity_path($extended_entity, $op); + if ($path && user_access($op_details['permission'])) { + $links[$op] = l($op_details['title'], $path); + } } } + else { + $links[] = ''; + } } if (!empty($links)) { diff --git a/lib/Drupal/DrupalCultureFeed_EntryApi.php b/lib/Drupal/DrupalCultureFeed_EntryApi.php index bedabbe4..243c8ba2 100644 --- a/lib/Drupal/DrupalCultureFeed_EntryApi.php +++ b/lib/Drupal/DrupalCultureFeed_EntryApi.php @@ -235,10 +235,15 @@ public static function removeTranslationFromActor(CultureFeed_Cdb_Item_Actor $ac * @see CultureFeed_EntryApi::checkPermission() */ public static function checkPermission($userid, $email, $ids) { - $permissions = json_decode( json_encode(self::getLoggedInUserInstance()->checkPermission($userid, $email, $ids)) , 1); + $permissions = (array)self::getLoggedInUserInstance()->checkPermission($userid, $email, $ids); $parsed_permissons = array(); - foreach ($permissions['event'] as $permission) { - $parsed_permissons[$permission['cdbid']] = $permission['editable']; + if (is_array($permissions['event'])) { + foreach ($permissions['event'] as $permission) { + $parsed_permissons[$permission->cdbid->__toString()] = $permission->editable->__toString(); + } + } + else { + $parsed_permissons[$permissions['event']->cdbid->__toString()] = $permissions['event']->editable->__toString(); } return $parsed_permissons; } From 630026d1d28bc7ef902bea6f954dc14450f198ac Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Fri, 12 Dec 2014 14:34:44 +0100 Subject: [PATCH 005/275] PWK-213 adding max characters on short desc --- culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 9225dd2a..ca8b6fc3 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -705,6 +705,8 @@ function culturefeed_entry_ui_event_form($form, $form_state, $event = NULL) { '#type' => 'textarea', '#title' => t('Short description'), '#rows' => 4, + '#maxlength' => 400, + '#description' => t('Maximum 400 characters'), '#default_value' => $default_short_description, '#element_validate' => array('culturefeed_entry_ui_validate_textarea_markup'), ); From 8b7345a5b3d2d2549b0c53c720a8f692fcf8c490 Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Fri, 12 Dec 2014 15:01:08 +0100 Subject: [PATCH 006/275] change to MEDIA_TYPE_PHOTO --- 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 ca8b6fc3..3559db54 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -2016,7 +2016,7 @@ function _culturefeed_entry_ui_ui_event_form_save_event($form, &$form_state, Cul // Add to detail $file = new CultureFeed_Cdb_Data_File(); - $file->setMediaType($file::MEDIA_TYPE_IMAGEWEB); + $file->setMediaType($file::MEDIA_TYPE_PHOTO); $file->setMain(TRUE); switch ($drupal_file->filemime) { case 'image/gif': From d233c69ea29815b14d589547c12d9d759d96a1aa Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Fri, 12 Dec 2014 16:01:53 +0100 Subject: [PATCH 007/275] CF-370 remove tags out of check permission --- ...iews_handler_field_cdb_item_operations.inc | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/culturefeed_entry_ui/views/handlers/views_handler_field_cdb_item_operations.inc b/culturefeed_entry_ui/views/handlers/views_handler_field_cdb_item_operations.inc index 3cfb7df2..74b80372 100644 --- a/culturefeed_entry_ui/views/handlers/views_handler_field_cdb_item_operations.inc +++ b/culturefeed_entry_ui/views/handlers/views_handler_field_cdb_item_operations.inc @@ -19,25 +19,20 @@ class views_handler_field_cdb_item_operations extends views_handler_field { $links = array(); if ($extended_entity->getType() === 'event') { + + // Update and delete $ops = array( 'edit' => array( 'permission' => 'edit culturefeed events', 'title' => t('Edit'), ), - 'tags' => array( - 'permission' => 'manage object tags', - 'title' => t('Tags'), - ), 'delete' => array( 'permission' => 'delete culturefeed events', 'title' => t('Delete'), ) ); - - $user = $cf_account = DrupalCultureFeed::getLoggedInUser(); - $ubd_permission = Drupalculturefeed_EntryApi::checkPermission($user->id, $user->mbox, array('ids' => $extended_entity->getId())); if ($ubd_permission[$extended_entity->getId()] == 'true') { @@ -49,8 +44,23 @@ class views_handler_field_cdb_item_operations extends views_handler_field { } } else { - $links[] = ''; + $links[] = ''; + } + + // Collaboration + $ops = array( + 'tags' => array( + 'permission' => 'manage object tags', + 'title' => t('Tags'), + ) + ); + foreach ($ops as $op => $op_details) { + $path = culturefeed_entry_ui_entity_path($extended_entity, $op); + if ($path && user_access($op_details['permission'])) { + $links[$op] = l($op_details['title'], $path); + } } + } if (!empty($links)) { From da3b27c111a38ab460f05704966cc285dce606b9 Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Mon, 15 Dec 2014 22:37:22 +0100 Subject: [PATCH 008/275] CF-375 fixing problems with urls --- .../includes/culturefeed_entry_ui.pages.inc | 8 +++++++- culturefeed_entry_ui/js/culturefeed_entry_ui.js | 10 ---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 3559db54..c6bb4b0c 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -216,6 +216,7 @@ function culturefeed_entry_ui_event_form($form, $form_state, $event = NULL) { CultureFeed_Cdb_Data_File::MEDIA_TYPE_YOUTUBE, CultureFeed_Cdb_Data_File::MEDIA_TYPE_GOOGLEPLUS, CultureFeed_Cdb_Data_File::MEDIA_TYPE_TWITTER, + CultureFeed_Cdb_Data_File::MEDIA_TYPE_WEBSITE, ) ); @@ -1722,12 +1723,17 @@ function culturefeed_entry_ui_event_save_validate($form, &$form_state) { }*/ // Validate Links + $i = 0; foreach ($values['links'] as $link_data) { if (!empty($link_data['URL'])) { + if (!preg_match("@^https?://@", $link_data['URL'])) { + $link_data['URL'] = 'http://' . $link_data['URL']; + } if (!valid_url($link_data['URL'], TRUE)) { - form_set_error('links', t('Not a valid URL')); + form_set_error('links][' . $i . '][URL', t('Not a valid URL')); } } + $i++; } // Validate organiser. diff --git a/culturefeed_entry_ui/js/culturefeed_entry_ui.js b/culturefeed_entry_ui/js/culturefeed_entry_ui.js index 34ccccc4..0e5025a7 100644 --- a/culturefeed_entry_ui/js/culturefeed_entry_ui.js +++ b/culturefeed_entry_ui/js/culturefeed_entry_ui.js @@ -54,16 +54,6 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; } }); - $('.link-field').focusout(function() { - if($(this).val() != '') { - console.log(this); - if($(this).val().indexOf('http://') == -1 || $(this).val().indexOf('https://') == -1) { - if($(this).val().substring(0,7) != 'http://' && $(this).val().substring(0,8) != 'https://') { - $(this).val('http://' + $(this).val()); - } - } - } - }); } }; From 87fbacdb1dbaf35d526dc9d7b722f62d28d92c38 Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Tue, 16 Dec 2014 00:58:10 +0100 Subject: [PATCH 009/275] CF-376 temp workaround to get actor suggests without consumer key --- .../includes/culturefeed_entry_ui.pages.inc | 6 +-- culturefeed_search/culturefeed_search.module | 15 ++++++- culturefeed_search/includes/pages.inc | 45 ++++++++++++------- 3 files changed, 46 insertions(+), 20 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index c6bb4b0c..764aab44 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -2,7 +2,7 @@ /** * @file * Page callbacks for the entry api ui. - */ + */ /** * Form callback: Create a new event, or edit an existing. @@ -541,7 +541,7 @@ function culturefeed_entry_ui_event_form($form, $form_state, $event = NULL) { $form['basic']['location']['actor']['location_actor_label'] = array( '#type' => 'textfield', '#title' => t('Location'), - '#autocomplete_path' => 'autocomplete/culturefeed/actor-suggestions', + '#autocomplete_path' => 'autocomplete/culturefeed/actor-suggestions/all', '#required' => FALSE, '#default_value' => isset($default_location_label) ? $default_location_label : '', '#size' => 80, @@ -950,7 +950,7 @@ function culturefeed_entry_ui_event_form($form, $form_state, $event = NULL) { $form['extra']['organiser']['actor']['organiser_actor_label'] = array( '#type' => 'textfield', '#title' => t('Organizer'), - '#autocomplete_path' => 'autocomplete/culturefeed/actor-suggestions', + '#autocomplete_path' => 'autocomplete/culturefeed/actor-suggestions/all', '#required' => FALSE, '#default_value' => $default_organiser_label, ); diff --git a/culturefeed_search/culturefeed_search.module b/culturefeed_search/culturefeed_search.module index 1277f711..a43859e9 100644 --- a/culturefeed_search/culturefeed_search.module +++ b/culturefeed_search/culturefeed_search.module @@ -31,16 +31,27 @@ function culturefeed_search_menu() { $items['autocomplete/culturefeed/suggestions'] = array( 'title' => 'Culturefeed suggestions autocomplete', 'page callback' => 'culturefeed_search_suggestions_autocomplete_page', - 'page arguments' => array(3, FALSE, NULL), + 'page arguments' => array(3, FALSE, NULL, FALSE), 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, 'file' => 'includes/pages.inc', ); + // Autocomplete path for actor $items['autocomplete/culturefeed/actor-suggestions'] = array( 'title' => 'Culturefeed suggestions autocomplete', 'page callback' => 'culturefeed_search_suggestions_autocomplete_page', - 'page arguments' => array(3, FALSE, 'actor'), + 'page arguments' => array(3, FALSE, 'actor', FALSE), + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, + 'file' => 'includes/pages.inc', + ); + + // Autocomplete path for all actors from production (temporary workaround for PWK-213) + $items['autocomplete/culturefeed/actor-suggestions/all'] = array( + 'title' => 'Culturefeed suggestions autocomplete', + 'page callback' => 'culturefeed_search_suggestions_autocomplete_page', + 'page arguments' => array(4, FALSE, 'actor', TRUE), 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, 'file' => 'includes/pages.inc', diff --git a/culturefeed_search/includes/pages.inc b/culturefeed_search/includes/pages.inc index 75bc9d74..ed7e88e7 100644 --- a/culturefeed_search/includes/pages.inc +++ b/culturefeed_search/includes/pages.inc @@ -5,11 +5,12 @@ */ use \Guzzle\Http\Exception; +use \Guzzle\Http\Client; /** * Autcomplete callback for the suggestions on Cdb items. */ -function culturefeed_search_suggestions_autocomplete_page($search_string, $past = FALSE, $type = NULL) { +function culturefeed_search_suggestions_autocomplete_page($search_string, $past = FALSE, $type = NULL, $all = FALSE) { $matches = array(); @@ -18,21 +19,35 @@ function culturefeed_search_suggestions_autocomplete_page($search_string, $past try { $types = !empty($type) ? array($type) : array(); - - // Get the list of suggestions from service. - $suggestions = culturefeed_get_search_service()->searchSuggestions($search_string, $types, $past); - if ($suggestions->hasSuggestions()) { - foreach ($suggestions as $suggestion) { - $title = $location_title = check_plain($suggestion->getTitle()); - $location = $suggestion->getLocation(); - if (!empty($location)) { - $location_title .= ' - (' . $location . ')'; + + if (!$all) { + // Get the list of suggestions from service. + $suggestions = culturefeed_get_search_service()->searchSuggestions($search_string, $types, $past); + if ($suggestions->hasSuggestions()) { + foreach ($suggestions as $suggestion) { + $title = $location_title = check_plain($suggestion->getTitle()); + $location = $suggestion->getLocation(); + if (!empty($location)) { + $location_title .= ' - (' . $location . ')'; + } + $object = new stdClass(); + $object->title = $title; + $object->key = $suggestion->getCdbId(); + $object->locationTitle = $location_title; + $matches[$suggestion->getCdbId()] = $object; + } + } + } + else { + $client = new Client(); + $client->setDefaultHeaders(array('Accept' => 'application/json')); + $body = json_decode($client->get('http://search-prod.lodgon.com/search/rest/search/suggest/item?title=' . $search_string . '&fq=type:actor%20asset:true')->send()->getBody(TRUE)); + foreach ($body->suggestions as $suggestion) { + $suffix = ''; + if (!empty($suggestion->zipcode)) { + $suffix .= ' - (' . $suggestion->zipcode . ')'; } - $object = new stdClass(); - $object->title = $title; - $object->key = $suggestion->getCdbId(); - $object->locationTitle = $location_title; - $matches[$suggestion->getCdbId()] = $object; + $matches[$suggestion->cdbid] = $suggestion->value . $suffix; } } From 8b8243ca9b06a633c57173fa5b863574c12cd72b Mon Sep 17 00:00:00 2001 From: HnLn Date: Wed, 17 Dec 2014 10:50:43 +0100 Subject: [PATCH 010/275] MSS-94 php 5.3 fix --- .../culturefeed_date_control/form/opening_times.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/culturefeed_entry_ui/culturefeed_date_control/form/opening_times.inc b/culturefeed_entry_ui/culturefeed_date_control/form/opening_times.inc index 02715405..da4d707d 100644 --- a/culturefeed_entry_ui/culturefeed_date_control/form/opening_times.inc +++ b/culturefeed_entry_ui/culturefeed_date_control/form/opening_times.inc @@ -56,14 +56,14 @@ function culturefeed_date_control_opening_times_process(array $element, array &$ ); $element['days'][$day][0]['open_from'] = array( - '#default_value' => isset($opening_times['days'][$day][0]['open_from']) ? $opening_times['days'][$day][0]['open_from'] : '', + '#default_value' => isset($opening_times['days'][$day]) && isset($opening_times['days'][$day][0]['open_from']) ? $opening_times['days'][$day][0]['open_from'] : '', '#description' => t('Format') . ': 12:00', '#size' => 12, '#type' => 'textfield', ); $element['days'][$day][0]['open_till'] = array( - '#default_value' => isset($opening_times['days'][$day][0]['open_till']) ? $opening_times['days'][$day][0]['open_till'] : '', + '#default_value' => isset($opening_times['days'][$day]) && isset($opening_times['days'][$day][0]['open_till']) ? $opening_times['days'][$day][0]['open_till'] : '', '#description' => t('Format') . ': 12:00', '#size' => 12, '#type' => 'textfield', From a963de2fe8e8aeea340c9eb3d7ecada265dd9fe7 Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Mon, 5 Jan 2015 17:01:47 +0100 Subject: [PATCH 011/275] adding $custom_entry_api_tags default value --- culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 54a74437..2db247bf 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -2269,6 +2269,7 @@ function _culturefeed_entry_ui_ui_event_form_save_event($form, &$form_state, Cul // Keywords. $keywords_form = array(); + $custom_entry_api_tags = array(); if ($values['keywords']) { $keywords_form = explode(';', $values['keywords']); } From 383f7d54c92be70e5a73d09cfb55f8f691ccbb0c Mon Sep 17 00:00:00 2001 From: svenhoutmeyers Date: Tue, 6 Jan 2015 16:15:38 +0100 Subject: [PATCH 012/275] small bugfixes + watchdog --- .../includes/culturefeed_entry_ui.pages.inc | 4 +++- culturefeed_search/includes/pages.inc | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 2db247bf..da2c5aa7 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -2296,10 +2296,12 @@ function _culturefeed_entry_ui_ui_event_form_save_event($form, &$form_state, Cul if ($update) { Drupalculturefeed_EntryApi::updateEvent($event); $form_state['#event_id'] = $event->getCdbId(); + watchdog('culturefeed_entry_ui', 'Event %eventid updated.', array('%eventid' => $form_state['#event_id'])); cache_clear_all('culturefeed:results:detail:event:' . $event->getCdbId(), 'cache_culturefeed_search'); } else { $form_state['#event_id'] = Drupalculturefeed_EntryApi::createEvent($event); + watchdog('culturefeed_entry_ui', 'Event %eventid created.', array('%eventid' => $form_state['#event_id'])); } $form_state['#update_event'] = $update; @@ -2450,7 +2452,7 @@ function culturefeed_entry_ui_delete_event_form_submit($form, &$form_state) { try { Drupalculturefeed_EntryApi::deleteEvent($form_state['values']['id']); drupal_set_message(t('Event successfully deleted')); - $form_state['redirect'] = ''; + $form_state['redirect'] = 'agenda/edit'; } catch (Exception $e) { watchdog_exception(WATCHDOG_ERROR, $e); drupal_set_message(t('An error occurred while deleting the event'), 'error'); diff --git a/culturefeed_search/includes/pages.inc b/culturefeed_search/includes/pages.inc index ed7e88e7..d0fdadb9 100644 --- a/culturefeed_search/includes/pages.inc +++ b/culturefeed_search/includes/pages.inc @@ -42,12 +42,19 @@ function culturefeed_search_suggestions_autocomplete_page($search_string, $past $client = new Client(); $client->setDefaultHeaders(array('Accept' => 'application/json')); $body = json_decode($client->get('http://search-prod.lodgon.com/search/rest/search/suggest/item?title=' . $search_string . '&fq=type:actor%20asset:true')->send()->getBody(TRUE)); - foreach ($body->suggestions as $suggestion) { - $suffix = ''; - if (!empty($suggestion->zipcode)) { - $suffix .= ' - (' . $suggestion->zipcode . ')'; + if ($body->suggestions) { + foreach ($body->suggestions as $suggestion) { + $title = $location_title = check_plain($suggestion->value); + $location = $suggestion->zipcode; + if (!empty($location)) { + $location_title .= ' - (' . $location->zipcode . ')'; + } + $object = new stdClass(); + $object->title = $title; + $object->key = $suggestion->cdbid; + $object->locationTitle = $location_title; + $matches[$suggestion->cdbid] = $object; } - $matches[$suggestion->cdbid] = $suggestion->value . $suffix; } } From a8bf987ea3b296171a34332f415e7d2eda934dcb Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 22 Jan 2015 10:55:10 +0100 Subject: [PATCH 013/275] MSS-117 point 2 custom locations can be edited now --- .../includes/culturefeed_entry_ui.pages.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index da2c5aa7..a616f3c1 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -7,7 +7,7 @@ /** * Form callback: Create a new event, or edit an existing. */ -function culturefeed_entry_ui_event_form($form, $form_state, $event = NULL) { +function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { $form = array(); @@ -110,8 +110,10 @@ function culturefeed_entry_ui_event_form($form, $form_state, $event = NULL) { $custom_location_street = $address->getStreet(); $custom_location_number = $address->getHouseNumber(); $custom_location_zip = $address->getZip(); - $custom_location_city = $address->getCity(); $custom_location_country = $address->getCountry(); + if ($custom_location_country == 'BE') { + $custom_location_city = $custom_location_zip . ' ' . $address->getCity(); + } } } From 8676331b3984a8aabe5cd4fd131298676cee1e80 Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Thu, 22 Jan 2015 13:41:47 +0100 Subject: [PATCH 014/275] MSS-124 fixing price issue --- culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index a616f3c1..c7448877 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -268,7 +268,7 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { // Default price if ($info = $event_details->getPrice()) { - $default_price = $info->getValue(); + $default_price = str_replace('.',',', $info->getValue()); $default_free_price = 0; $default_price_description = $info->getDescription(); if ($default_price == '0.00') { @@ -2080,7 +2080,7 @@ function _culturefeed_entry_ui_ui_event_form_save_event($form, &$form_state, Cul } else { if (!empty($values['price']['amount'])) { - $price = new CultureFeed_Cdb_Data_Price(floatval($values['price']['amount'])); + $price = new CultureFeed_Cdb_Data_Price(floatval(str_replace(',','.', $values['price']['amount']))); if (!empty($values['price']['extra']['extra_info'])) { $price->setDescription($values['price']['extra']['extra_info']); } From 2a5755bd896b02e2e8a21b0f19cca399917fd5f3 Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Thu, 22 Jan 2015 15:09:46 +0100 Subject: [PATCH 015/275] MSS-123 possible fix for images with spaces in filename --- .../includes/culturefeed_entry_ui.pages.inc | 23 ++++++++++++++++--- 1 file changed, 20 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 a616f3c1..00aa3aca 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -259,6 +259,7 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { if ($default_image) { file_usage_add($default_image, 'culturefeed_entry_ui', 'event', $default_image->fid); $default_image_hlink = $main_image->getHLink(); + $default_copyright = $main_image->getCopyright(); } } catch (Exception $e) { watchdog_exception('culturefeed_entry_ui', $e); @@ -840,7 +841,15 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { '#value' => $default_image_hlink, ); } - + + // Copyright + $form['extra']['photo']['copyright_text'] = array( + '#type' => 'textfield', + '#title' => t('Copyright'), + '#description' => t('Name of the copyright owner of this image.'), + '#default_value' => isset($default_copyright) ? $default_copyright : '', + '#size' => 30, + ); $form['extra']['photo']['copyright'] = array( '#type' => 'checkbox', '#default_value' => isset($default_image->fid) ? 1 : 0, @@ -1671,6 +1680,9 @@ function culturefeed_entry_ui_event_save_validate($form, &$form_state) { if (!empty($values['photo']['upload']) && $values['photo']['copyright'] != 1) { form_set_error('photo', t('Please agree to the general conditions of UiTdatabank and declare that you have the necessary rights or permissions to distribute the image through UiTdatabank.')); } + if (!empty($values['photo']['upload']) && empty($values['photo']['copyright_text'])) { + form_set_error('photo', t('Copyright field is required.')); + } // Validate categories if (empty($values['what'])) { @@ -2025,17 +2037,22 @@ function _culturefeed_entry_ui_ui_event_form_save_event($form, &$form_state, Cul // Photo if ($values['photo']['upload']) { + + // Save to Drupal $drupal_file = file_load($values['photo']['upload']); - $drupal_file->status = FILE_STATUS_PERMANENT; - + $drupal_file->status = FILE_STATUS_PERMANENT; + $drupal_file->filename = urlencode($drupal_file->filename); //fix filenames with spaces + $drupal_file->uri = 'public://uploads/' . $drupal_file->filename; file_save($drupal_file); file_usage_add($drupal_file, 'culturefeed_entry_ui', 'event', $drupal_file->fid); + // Add to detail $file = new CultureFeed_Cdb_Data_File(); $file->setMediaType($file::MEDIA_TYPE_PHOTO); + $file->setCopyright($values['photo']['copyright_text']); $file->setMain(TRUE); switch ($drupal_file->filemime) { case 'image/gif': From 7c75c26eff99dae37b0fc03e2894dc91eba5d923 Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 22 Jan 2015 15:25:44 +0100 Subject: [PATCH 016/275] MSS-119 punt 3 arrow keys and tabs --- .../js/bootstrap_autocomplete_override.js | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js index 000901db..c0a0ba43 100644 --- a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js +++ b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js @@ -1,8 +1,31 @@ (function ($) { -/** - * Fills the suggestion popup with any matches received. - */ + + /** + * Hides the autocomplete suggestions. + */ + Drupal.jsAC.prototype.hidePopup = function (keycode) { + // Select item if the right key or mousebutton was pressed. + if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) { + this.input.value = $(this.selected).data('autocompleteValue'); + } + // Hide popup. + var popup = this.popup; + if (popup) { + this.popup = null; + $(popup).fadeOut('fast', function () { $(popup).remove(); }); + } + this.selected = false; + $(this.ariaLive).empty(); + + // Workaround for bootstrap losing tabindex on autocomplete popup. + $(this.input).parents('.form-item').next().find(':tabbable').focus(); + + }; + + /** + * Fills the suggestion popup with any matches received. + */ Drupal.jsAC.prototype.found = function (matches) { // If no value in the textfield, do not show the popup. if (!this.input.value.length) { From c67647c381d56cc32f549066e067635882fbd1fc Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 22 Jan 2015 15:48:37 +0100 Subject: [PATCH 017/275] MSS-119 point 3 extra conditions --- .../js/bootstrap_autocomplete_override.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js index c0a0ba43..7d2b8002 100644 --- a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js +++ b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js @@ -4,7 +4,7 @@ /** * Hides the autocomplete suggestions. */ - Drupal.jsAC.prototype.hidePopup = function (keycode) { + Drupal.jsAC.prototype.hidePopup = function (keycode, op) { // Select item if the right key or mousebutton was pressed. if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) { this.input.value = $(this.selected).data('autocompleteValue'); @@ -19,7 +19,9 @@ $(this.ariaLive).empty(); // Workaround for bootstrap losing tabindex on autocomplete popup. - $(this.input).parents('.form-item').next().find(':tabbable').focus(); + if ((!op || op != 'empty') && this.input.value) { + $(this.input).parents('.form-item').next().find(':tabbable').focus(); + } }; @@ -79,7 +81,7 @@ } else { $(this.popup).css({ visibility: 'hidden' }); - this.hidePopup(); + this.hidePopup(null, 'empty'); if (this.input.name == 'organiser[actor][organiser_actor_label]') { $('#edit-organiser-add-new-actor').css({ display: 'block' }); $('#organiser_actor_id').val(''); From d704402be86ace715a36806d2ba6eae3175fe0e5 Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Thu, 22 Jan 2015 15:56:07 +0100 Subject: [PATCH 018/275] adding transliteration --- culturefeed_entry_ui/culturefeed_entry_ui.info | 1 + .../includes/culturefeed_entry_ui.pages.inc | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/culturefeed_entry_ui/culturefeed_entry_ui.info b/culturefeed_entry_ui/culturefeed_entry_ui.info index 14b0a6a8..f11ff2a3 100644 --- a/culturefeed_entry_ui/culturefeed_entry_ui.info +++ b/culturefeed_entry_ui/culturefeed_entry_ui.info @@ -11,6 +11,7 @@ dependencies[] = file dependencies[] = date dependencies[] = date_api dependencies[] = date_popup +dependencies[] = transliteration files[] = views/handlers/views_handler_field_cdb_item_operations.inc files[] = views/handlers/views_handler_area_cdb_item_create.inc diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 00aa3aca..d3d949e0 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -2037,17 +2037,12 @@ function _culturefeed_entry_ui_ui_event_form_save_event($form, &$form_state, Cul // Photo if ($values['photo']['upload']) { - - // Save to Drupal $drupal_file = file_load($values['photo']['upload']); - $drupal_file->status = FILE_STATUS_PERMANENT; - $drupal_file->filename = urlencode($drupal_file->filename); //fix filenames with spaces - $drupal_file->uri = 'public://uploads/' . $drupal_file->filename; + $drupal_file->status = FILE_STATUS_PERMANENT; file_save($drupal_file); file_usage_add($drupal_file, 'culturefeed_entry_ui', 'event', $drupal_file->fid); - // Add to detail $file = new CultureFeed_Cdb_Data_File(); From 47c0686954645fed349ef66f0e2993adbfffb198 Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 22 Jan 2015 15:56:46 +0100 Subject: [PATCH 019/275] MSS-119 point 3 more fixes --- .../js/bootstrap_autocomplete_override.js | 24 ------------------- .../js/culturefeed_entry_ui.js | 9 ++++++- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js index 7d2b8002..4d2b2666 100644 --- a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js +++ b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js @@ -1,30 +1,6 @@ (function ($) { - /** - * Hides the autocomplete suggestions. - */ - Drupal.jsAC.prototype.hidePopup = function (keycode, op) { - // Select item if the right key or mousebutton was pressed. - if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) { - this.input.value = $(this.selected).data('autocompleteValue'); - } - // Hide popup. - var popup = this.popup; - if (popup) { - this.popup = null; - $(popup).fadeOut('fast', function () { $(popup).remove(); }); - } - this.selected = false; - $(this.ariaLive).empty(); - - // Workaround for bootstrap losing tabindex on autocomplete popup. - if ((!op || op != 'empty') && this.input.value) { - $(this.input).parents('.form-item').next().find(':tabbable').focus(); - } - - }; - /** * Fills the suggestion popup with any matches received. */ diff --git a/culturefeed_entry_ui/js/culturefeed_entry_ui.js b/culturefeed_entry_ui/js/culturefeed_entry_ui.js index 0e5025a7..da47b421 100644 --- a/culturefeed_entry_ui/js/culturefeed_entry_ui.js +++ b/culturefeed_entry_ui/js/culturefeed_entry_ui.js @@ -61,7 +61,7 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; /** * Hides the autocomplete suggestions. */ - Drupal.jsAC.prototype.hidePopup = function (keycode) { + Drupal.jsAC.prototype.hidePopup = function (keycode, op) { // Select item if the right key or mousebutton was pressed. if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) { @@ -93,6 +93,13 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; } this.selected = false; $(this.ariaLive).empty(); + + // Workaround for bootstrap losing tabindex on autocomplete popup. + if ((!op || op != 'empty') && this.input.value) { + $(this.input).parents('.form-item').next().find(':tabbable').focus(); + } + + }; /** From 322f0ac1ecb61f204c1f3e176c3913f1ddef92b8 Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 29 Jan 2015 10:36:26 +0100 Subject: [PATCH 020/275] MSS-119 punt 5 --- culturefeed_entry_ui/js/culturefeed_entry_ui.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/culturefeed_entry_ui/js/culturefeed_entry_ui.js b/culturefeed_entry_ui/js/culturefeed_entry_ui.js index da47b421..cbbed6e1 100644 --- a/culturefeed_entry_ui/js/culturefeed_entry_ui.js +++ b/culturefeed_entry_ui/js/culturefeed_entry_ui.js @@ -58,6 +58,18 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; }; + /** + * + * Fire the autocomplete on paste. + */ + Drupal.behaviors.autocomplete_paste = { + attach: function (context, settings) { + $('.form-autocomplete input').bind("paste", function () { + $(this).populatePopup(); + }); + } + } + /** * Hides the autocomplete suggestions. */ From e10faeaed446652484702d57c4418f30370c0686 Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 29 Jan 2015 11:12:32 +0100 Subject: [PATCH 021/275] MSS-120 contact email fix --- .../includes/culturefeed_entry_ui.pages.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index a616f3c1..e9380889 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -1847,8 +1847,10 @@ function _culturefeed_entry_ui_ui_event_form_save_event($form, &$form_state, Cul array_push($phones, $phone); break; case '1': - $mail = new CultureFeed_Cdb_Data_Mail($extra['channel_input'], FALSE, FALSE); - array_push($mails, $mail); + if ($extra['channel_input']) { + $mail = new CultureFeed_Cdb_Data_Mail($extra['channel_input'], FALSE, FALSE); + array_push($mails, $mail); + } break; } } From 137c4aa6b16760bb35a1929dcbb62c7597dfebc6 Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 29 Jan 2015 12:32:04 +0100 Subject: [PATCH 022/275] MSS-121 maxlength --- .../includes/culturefeed_entry_ui.pages.inc | 6 +- .../js/culturefeed_entry_ui.js | 13 +- .../js/maxlength/jquery.maxlength-fr.js | 12 + .../js/maxlength/jquery.maxlength.css | 14 + .../js/maxlength/jquery.maxlength.js | 230 ++++++++++++ .../js/maxlength/jquery.maxlength.min.js | 6 + .../js/maxlength/jquery.plugin.js | 344 ++++++++++++++++++ .../js/maxlength/jquery.plugin.min.js | 4 + .../js/maxlength/maxlengthBasic.html | 26 ++ 9 files changed, 653 insertions(+), 2 deletions(-) create mode 100644 culturefeed_entry_ui/js/maxlength/jquery.maxlength-fr.js create mode 100644 culturefeed_entry_ui/js/maxlength/jquery.maxlength.css create mode 100644 culturefeed_entry_ui/js/maxlength/jquery.maxlength.js create mode 100644 culturefeed_entry_ui/js/maxlength/jquery.maxlength.min.js create mode 100644 culturefeed_entry_ui/js/maxlength/jquery.plugin.js create mode 100644 culturefeed_entry_ui/js/maxlength/jquery.plugin.min.js create mode 100644 culturefeed_entry_ui/js/maxlength/maxlengthBasic.html diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index e9380889..7267f059 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -189,6 +189,7 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { $default_long_description = $event_details->getLongDescription(); $source_text = '/

(.*)<\/p>/'; $default_long_description = preg_replace($source_text, '', $default_long_description); + $default_long_description = filter_xss($default_long_description, array()); //$default_long_description = substr($default_long_description, 0, -169); $form_state['#ld_needed'] = TRUE; } @@ -709,9 +710,10 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { '#title' => t('Short description'), '#rows' => 4, '#maxlength' => 400, - '#description' => t('Maximum 400 characters'), + //'#description' => t('Maximum 400 characters'), '#default_value' => $default_short_description, '#element_validate' => array('culturefeed_entry_ui_validate_textarea_markup'), + '#suffix' => '', ); $form['extra']['description']['ld'] = array( @@ -1380,6 +1382,8 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { else { $form['#attached']['js'][] = drupal_get_path('module', 'culturefeed_entry_ui') . '/js/culturefeed_entry_ui.js'; } + $form['#attached']['js'][] = drupal_get_path('module', 'culturefeed_entry_ui') . '/js/maxlength/jquery.plugin.js'; + $form['#attached']['js'][] = drupal_get_path('module', 'culturefeed_entry_ui') . '/js/maxlength/jquery.maxlength.js'; return $form; } diff --git a/culturefeed_entry_ui/js/culturefeed_entry_ui.js b/culturefeed_entry_ui/js/culturefeed_entry_ui.js index cbbed6e1..e5c22d64 100644 --- a/culturefeed_entry_ui/js/culturefeed_entry_ui.js +++ b/culturefeed_entry_ui/js/culturefeed_entry_ui.js @@ -59,7 +59,18 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; }; /** - * + * Maxlength + */ + Drupal.behaviors.maxlength = { + attach: function (context, settings) { + $('#edit-description-sd-short-description').maxlength({ + max: 400, + feedbackTarget: '#edit-description-sd-short-description-maxlength-counter' + }); + } + } + + /** * Fire the autocomplete on paste. */ Drupal.behaviors.autocomplete_paste = { diff --git a/culturefeed_entry_ui/js/maxlength/jquery.maxlength-fr.js b/culturefeed_entry_ui/js/maxlength/jquery.maxlength-fr.js new file mode 100644 index 00000000..e7cf26a3 --- /dev/null +++ b/culturefeed_entry_ui/js/maxlength/jquery.maxlength-fr.js @@ -0,0 +1,12 @@ +/* http://keith-wood.name/maxlength.html + French initialisation for the jQuery Max Length extension + Written by Keith Wood (kbwood{at}iinet.com.au) April 2012. */ +(function($) { // hide the namespace + +$.maxlength.regionalOptions['fr'] = { + feedbackText: '{r} de caractères restants ({m} maximum)', + overflowText: '{o} de caractères trop ({m} maximum)' +}; +$.maxlength.setDefaults($.maxlength.regionalOptions['fr']); + +})(jQuery); diff --git a/culturefeed_entry_ui/js/maxlength/jquery.maxlength.css b/culturefeed_entry_ui/js/maxlength/jquery.maxlength.css new file mode 100644 index 00000000..b4b3ed06 --- /dev/null +++ b/culturefeed_entry_ui/js/maxlength/jquery.maxlength.css @@ -0,0 +1,14 @@ +/* Styles for Max Length plugin v2.0.0 */ +.maxlength-feedback { + margin-left: 0.5em; + font-size: 75%; +} +.maxlength-full { + background-color: #fee; +} +.maxlength-overflow { + background-color: #fcc; +} +.maxlength-disabled { + opacity: 0.5; +} diff --git a/culturefeed_entry_ui/js/maxlength/jquery.maxlength.js b/culturefeed_entry_ui/js/maxlength/jquery.maxlength.js new file mode 100644 index 00000000..71cd0da5 --- /dev/null +++ b/culturefeed_entry_ui/js/maxlength/jquery.maxlength.js @@ -0,0 +1,230 @@ +/* http://keith-wood.name/maxlength.html + Textarea Max Length for jQuery v2.0.0. + Written by Keith Wood (kwood{at}iinet.com.au) May 2009. + Licensed under the MIT (https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) license. + Please attribute the author if you use it. */ + +(function($) { // hide the namespace + + var pluginName = 'maxlength'; + + /** Create the maxlength plugin. +

Sets a textarea to limit the number of characters that may be entered.

+

Expects HTML like:

+
<textarea>
+		

Provide inline configuration like:

+
<textarea data-maxlength="name: 'value'"></textarea>
+ @module MaxLength + @augments JQPlugin + @example $(selector).maxlength() */ + $.JQPlugin.createPlugin({ + + /** The name of the plugin. */ + name: pluginName, + + /** Maxlength full callback. + Triggered when the text area is full or overflowing. + @callback fullCallback + @param overflowing {boolean} True if overflowing, false if not. + @example onFull: function(overflowing) { + $(this).addClass(overflowing ? 'overflow' : 'full'); +} */ + + /** Default settings for the plugin. + @property [max=200] {number} Maximum length. + @property [truncate=true] {boolean} True to disallow further input, false to highlight only. + @property [showFeedback=true] {boolean} True to always show user feedback, 'active' for hover/focus only. + @property [feedbackTarget=null] {string|Element|jQuery|function} jQuery selector, element, + or jQuery object, or function for element to fill with feedback. + @property [onFull=null] {fullCallback} Callback when full or overflowing. */ + defaultOptions: { + max: 200, + truncate: true, + showFeedback: true, + feedbackTarget: null, + onFull: null + }, + + /** Localisations for the plugin. + Entries are objects indexed by the language code ('' being the default US/English). + Each object has the following attributes. + @property [feedbackText='{r} characters remaining ({m} maximum)'] {string} + Display text for feedback message, use {r} for remaining characters, + {c} for characters entered, {m} for maximum. + @property [overflowText='{o} characters too many ({m} maximum)'] {string} + Display text when past maximum, use substitutions above and {o} for characters past maximum. */ + regionalOptions: { // Available regional settings, indexed by language/country code + '': { // Default regional settings - English/US + feedbackText: '{r} characters remaining ({m} maximum)', + overflowText: '{o} characters too many ({m} maximum)' + } + }, + + /** Names of getter methods - those that can't be chained. */ + _getters: ['curLength'], + + _feedbackClass: pluginName + '-feedback', //Class name for the feedback section + _fullClass: pluginName + '-full', // Class name for indicating the textarea is full + _overflowClass: pluginName + '-overflow', // Class name for indicating the textarea is overflowing + _disabledClass: pluginName + '-disabled', // Class name for indicating the textarea is disabled + + _instSettings: function(elem, options) { + return {feedbackTarget: $([])}; + }, + + _postAttach: function(elem, inst) { + elem.on('keypress.' + inst.name, function(event) { + if (!inst.options.truncate) { + return true; + } + var ch = String.fromCharCode( + event.charCode == undefined ? event.keyCode : event.charCode); + return (event.ctrlKey || event.metaKey || ch == '\u0000' || + $(this).val().length < inst.options.max); + }). + on('keyup.' + inst.name, function() { $.maxlength._checkLength(elem); }); + }, + + _optionsChanged: function(elem, inst, options) { + $.extend(inst.options, options); + if (inst.feedbackTarget.length > 0) { // Remove old feedback element + if (inst.hadFeedbackTarget) { + inst.feedbackTarget.empty().val(''). + removeClass(this._feedbackClass + ' ' + this._fullClass + ' ' + this._overflowClass); + } + else { + inst.feedbackTarget.remove(); + } + inst.feedbackTarget = $([]); + } + if (inst.options.showFeedback) { // Add new feedback element + inst.hadFeedbackTarget = !!inst.options.feedbackTarget; + if ($.isFunction(inst.options.feedbackTarget)) { + inst.feedbackTarget = inst.options.feedbackTarget.apply(elem[0], []); + } + else if (inst.options.feedbackTarget) { + inst.feedbackTarget = $(inst.options.feedbackTarget); + } + else { + inst.feedbackTarget = $('').insertAfter(elem); + } + inst.feedbackTarget.addClass(this._feedbackClass); + } + elem.off('mouseover.' + inst.name + ' focus.' + inst.name + + 'mouseout.' + inst.name + ' blur.' + inst.name); + if (inst.options.showFeedback == 'active') { // Additional event handlers + elem.on('mouseover.' + inst.name, function() { + inst.feedbackTarget.css('visibility', 'visible'); + }).on('mouseout.' + inst.name, function() { + if (!inst.focussed) { + inst.feedbackTarget.css('visibility', 'hidden'); + } + }).on('focus.' + inst.name, function() { + inst.focussed = true; + inst.feedbackTarget.css('visibility', 'visible'); + }).on('blur.' + inst.name, function() { + inst.focussed = false; + inst.feedbackTarget.css('visibility', 'hidden'); + }); + inst.feedbackTarget.css('visibility', 'hidden'); + } + this._checkLength(elem); + }, + + /** Retrieve the counts of characters used and remaining. + @param elem {jQuery} The control to check. + @return {object} The current counts with attributes used and remaining. + @example var lengths = $(selector).maxlength('curLength'); */ + curLength: function(elem) { + var inst = this._getInst(elem); + var value = elem.val(); + var len = value.replace(/\r\n/g, '~~').replace(/\n/g, '~~').length; + return {used: len, remaining: inst.options.max - len}; + }, + + /** Check the length of the text and notify accordingly. + @private + @param elem {jQuery} The control to check. */ + _checkLength: function(elem) { + var inst = this._getInst(elem); + var value = elem.val(); + var len = value.replace(/\r\n/g, '~~').replace(/\n/g, '~~').length; + elem.toggleClass(this._fullClass, len >= inst.options.max). + toggleClass(this._overflowClass, len > inst.options.max); + if (len > inst.options.max && inst.options.truncate) { // Truncation + var lines = elem.val().split(/\r\n|\n/); + value = ''; + var i = 0; + while (value.length < inst.options.max && i < lines.length) { + value += lines[i].substring(0, inst.options.max - value.length) + '\r\n'; + i++; + } + elem.val(value.substring(0, inst.options.max)); + elem[0].scrollTop = elem[0].scrollHeight; // Scroll to bottom + len = inst.options.max; + } + inst.feedbackTarget.toggleClass(this._fullClass, len >= inst.options.max). + toggleClass(this._overflowClass, len > inst.options.max); + var feedback = (len > inst.options.max ? // Feedback + inst.options.overflowText : inst.options.feedbackText). + replace(/\{c\}/, len).replace(/\{m\}/, inst.options.max). + replace(/\{r\}/, inst.options.max - len). + replace(/\{o\}/, len - inst.options.max); + try { + inst.feedbackTarget.text(feedback); + } + catch(e) { + // Ignore + } + try { + inst.feedbackTarget.val(feedback); + } + catch(e) { + // Ignore + } + if (len >= inst.options.max && $.isFunction(inst.options.onFull)) { + inst.options.onFull.apply(elem, [len > inst.options.max]); + } + }, + + /** Enable the control. + @param elem {Element} The control to affect. + @example $(selector).maxlength('enable'); */ + enable: function(elem) { + elem = $(elem); + if (!elem.hasClass(this._getMarker())) { + return; + } + var inst = this._getInst(elem); + elem.prop('disabled', false).removeClass(inst.name + '-disabled'); + inst.feedbackTarget.removeClass(inst.name + '-disabled'); + }, + + /** Disable the control. + @param elem {Element} The control to affect. + @example $(selector).maxlength('disable'); */ + disable: function(elem) { + elem = $(elem); + if (!elem.hasClass(this._getMarker())) { + return; + } + var inst = this._getInst(elem); + elem.prop('disabled', true).addClass(inst.name + '-disabled'); + inst.feedbackTarget.addClass(inst.name + '-disabled'); + }, + + _preDestroy: function(elem, inst) { + if (inst.feedbackTarget.length > 0) { + if (inst.hadFeedbackTarget) { + inst.feedbackTarget.empty().val('').css('visibility', 'visible'). + removeClass(this._feedbackClass + ' ' + this._fullClass + ' ' + this._overflowClass); + } + else { + inst.feedbackTarget.remove(); + } + } + elem.removeClass(this._fullClass + ' ' + this._overflowClass).off('.' + inst.name); + } + }); + +})(jQuery); diff --git a/culturefeed_entry_ui/js/maxlength/jquery.maxlength.min.js b/culturefeed_entry_ui/js/maxlength/jquery.maxlength.min.js new file mode 100644 index 00000000..584a87e6 --- /dev/null +++ b/culturefeed_entry_ui/js/maxlength/jquery.maxlength.min.js @@ -0,0 +1,6 @@ +/* http://keith-wood.name/maxlength.html + Textarea Max Length for jQuery v2.0.0. + Written by Keith Wood (kwood{at}iinet.com.au) May 2009. + Licensed under the MIT (https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) license. + Please attribute the author if you use it. */ +(function($){var h='maxlength';$.JQPlugin.createPlugin({name:h,defaultOptions:{max:200,truncate:true,showFeedback:true,feedbackTarget:null,onFull:null},regionalOptions:{'':{feedbackText:'{r} characters remaining ({m} maximum)',overflowText:'{o} characters too many ({m} maximum)'}},_getters:['curLength'],_feedbackClass:h+'-feedback',_fullClass:h+'-full',_overflowClass:h+'-overflow',_disabledClass:h+'-disabled',_instSettings:function(a,b){return{feedbackTarget:$([])}},_postAttach:function(c,d){c.on('keypress.'+d.name,function(a){if(!d.options.truncate){return true}var b=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return(a.ctrlKey||a.metaKey||b=='\u0000'||$(this).val().length0){if(b.hadFeedbackTarget){b.feedbackTarget.empty().val('').removeClass(this._feedbackClass+' '+this._fullClass+' '+this._overflowClass)}else{b.feedbackTarget.remove()}b.feedbackTarget=$([])}if(b.options.showFeedback){b.hadFeedbackTarget=!!b.options.feedbackTarget;if($.isFunction(b.options.feedbackTarget)){b.feedbackTarget=b.options.feedbackTarget.apply(a[0],[])}else if(b.options.feedbackTarget){b.feedbackTarget=$(b.options.feedbackTarget)}else{b.feedbackTarget=$('').insertAfter(a)}b.feedbackTarget.addClass(this._feedbackClass)}a.off('mouseover.'+b.name+' focus.'+b.name+'mouseout.'+b.name+' blur.'+b.name);if(b.options.showFeedback=='active'){a.on('mouseover.'+b.name,function(){b.feedbackTarget.css('visibility','visible')}).on('mouseout.'+b.name,function(){if(!b.focussed){b.feedbackTarget.css('visibility','hidden')}}).on('focus.'+b.name,function(){b.focussed=true;b.feedbackTarget.css('visibility','visible')}).on('blur.'+b.name,function(){b.focussed=false;b.feedbackTarget.css('visibility','hidden')});b.feedbackTarget.css('visibility','hidden')}this._checkLength(a)},curLength:function(a){var b=this._getInst(a);var c=a.val();var d=c.replace(/\r\n/g,'~~').replace(/\n/g,'~~').length;return{used:d,remaining:b.options.max-d}},_checkLength:function(a){var b=this._getInst(a);var c=a.val();var d=c.replace(/\r\n/g,'~~').replace(/\n/g,'~~').length;a.toggleClass(this._fullClass,d>=b.options.max).toggleClass(this._overflowClass,d>b.options.max);if(d>b.options.max&&b.options.truncate){var f=a.val().split(/\r\n|\n/);c='';var i=0;while(c.length=b.options.max).toggleClass(this._overflowClass,d>b.options.max);var g=(d>b.options.max?b.options.overflowText:b.options.feedbackText).replace(/\{c\}/,d).replace(/\{m\}/,b.options.max).replace(/\{r\}/,b.options.max-d).replace(/\{o\}/,d-b.options.max);try{b.feedbackTarget.text(g)}catch(e){}try{b.feedbackTarget.val(g)}catch(e){}if(d>=b.options.max&&$.isFunction(b.options.onFull)){b.options.onFull.apply(a,[d>b.options.max])}},enable:function(a){a=$(a);if(!a.hasClass(this._getMarker())){return}var b=this._getInst(a);a.prop('disabled',false).removeClass(b.name+'-disabled');b.feedbackTarget.removeClass(b.name+'-disabled')},disable:function(a){a=$(a);if(!a.hasClass(this._getMarker())){return}var b=this._getInst(a);a.prop('disabled',true).addClass(b.name+'-disabled');b.feedbackTarget.addClass(b.name+'-disabled')},_preDestroy:function(a,b){if(b.feedbackTarget.length>0){if(b.hadFeedbackTarget){b.feedbackTarget.empty().val('').css('visibility','visible').removeClass(this._feedbackClass+' '+this._fullClass+' '+this._overflowClass)}else{b.feedbackTarget.remove()}}a.removeClass(this._fullClass+' '+this._overflowClass).off('.'+b.name)}})})(jQuery); \ No newline at end of file diff --git a/culturefeed_entry_ui/js/maxlength/jquery.plugin.js b/culturefeed_entry_ui/js/maxlength/jquery.plugin.js new file mode 100644 index 00000000..71767a6b --- /dev/null +++ b/culturefeed_entry_ui/js/maxlength/jquery.plugin.js @@ -0,0 +1,344 @@ +/* Simple JavaScript Inheritance + * By John Resig http://ejohn.org/ + * MIT Licensed. + */ +// Inspired by base2 and Prototype +(function(){ + var initializing = false; + + // The base JQClass implementation (does nothing) + window.JQClass = function(){}; + + // Collection of derived classes + JQClass.classes = {}; + + // Create a new JQClass that inherits from this class + JQClass.extend = function extender(prop) { + var base = this.prototype; + + // Instantiate a base class (but only create the instance, + // don't run the init constructor) + initializing = true; + var prototype = new this(); + initializing = false; + + // Copy the properties over onto the new prototype + for (var name in prop) { + // Check if we're overwriting an existing function + prototype[name] = typeof prop[name] == 'function' && + typeof base[name] == 'function' ? + (function(name, fn){ + return function() { + var __super = this._super; + + // Add a new ._super() method that is the same method + // but on the super-class + this._super = function(args) { + return base[name].apply(this, args || []); + }; + + var ret = fn.apply(this, arguments); + + // The method only need to be bound temporarily, so we + // remove it when we're done executing + this._super = __super; + + return ret; + }; + })(name, prop[name]) : + prop[name]; + } + + // The dummy class constructor + function JQClass() { + // All construction is actually done in the init method + if (!initializing && this._init) { + this._init.apply(this, arguments); + } + } + + // Populate our constructed prototype object + JQClass.prototype = prototype; + + // Enforce the constructor to be what we expect + JQClass.prototype.constructor = JQClass; + + // And make this class extendable + JQClass.extend = extender; + + return JQClass; + }; +})(); + +(function($) { // Ensure $, encapsulate + + /** Abstract base class for collection plugins v1.0.1. + Written by Keith Wood (kbwood{at}iinet.com.au) December 2013. + Licensed under the MIT (https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) license. + @module $.JQPlugin + @abstract */ + JQClass.classes.JQPlugin = JQClass.extend({ + + /** Name to identify this plugin. + @example name: 'tabs' */ + name: 'plugin', + + /** Default options for instances of this plugin (default: {}). + @example defaultOptions: { + selectedClass: 'selected', + triggers: 'click' + } */ + defaultOptions: {}, + + /** Options dependent on the locale. + Indexed by language and (optional) country code, with '' denoting the default language (English/US). + @example regionalOptions: { + '': { + greeting: 'Hi' + } + } */ + regionalOptions: {}, + + /** Names of getter methods - those that can't be chained (default: []). + @example _getters: ['activeTab'] */ + _getters: [], + + /** Retrieve a marker class for affected elements. + @private + @return {string} The marker class. */ + _getMarker: function() { + return 'is-' + this.name; + }, + + /** Initialise the plugin. + Create the jQuery bridge - plugin name xyz + produces $.xyz and $.fn.xyz. */ + _init: function() { + // Apply default localisations + $.extend(this.defaultOptions, (this.regionalOptions && this.regionalOptions['']) || {}); + // Camel-case the name + var jqName = camelCase(this.name); + // Expose jQuery singleton manager + $[jqName] = this; + // Expose jQuery collection plugin + $.fn[jqName] = function(options) { + var otherArgs = Array.prototype.slice.call(arguments, 1); + if ($[jqName]._isNotChained(options, otherArgs)) { + return $[jqName][options].apply($[jqName], [this[0]].concat(otherArgs)); + } + return this.each(function() { + if (typeof options === 'string') { + if (options[0] === '_' || !$[jqName][options]) { + throw 'Unknown method: ' + options; + } + $[jqName][options].apply($[jqName], [this].concat(otherArgs)); + } + else { + $[jqName]._attach(this, options); + } + }); + }; + }, + + /** Set default values for all subsequent instances. + @param options {object} The new default options. + @example $.plugin.setDefauls({name: value}) */ + setDefaults: function(options) { + $.extend(this.defaultOptions, options || {}); + }, + + /** Determine whether a method is a getter and doesn't permit chaining. + @private + @param name {string} The method name. + @param otherArgs {any[]} Any other arguments for the method. + @return {boolean} True if this method is a getter, false otherwise. */ + _isNotChained: function(name, otherArgs) { + if (name === 'option' && (otherArgs.length === 0 || + (otherArgs.length === 1 && typeof otherArgs[0] === 'string'))) { + return true; + } + return $.inArray(name, this._getters) > -1; + }, + + /** Initialise an element. Called internally only. + Adds an instance object as data named for the plugin. + @param elem {Element} The element to enhance. + @param options {object} Overriding settings. */ + _attach: function(elem, options) { + elem = $(elem); + if (elem.hasClass(this._getMarker())) { + return; + } + elem.addClass(this._getMarker()); + options = $.extend({}, this.defaultOptions, this._getMetadata(elem), options || {}); + var inst = $.extend({name: this.name, elem: elem, options: options}, + this._instSettings(elem, options)); + elem.data(this.name, inst); // Save instance against element + this._postAttach(elem, inst); + this.option(elem, options); + }, + + /** Retrieve additional instance settings. + Override this in a sub-class to provide extra settings. + @param elem {jQuery} The current jQuery element. + @param options {object} The instance options. + @return {object} Any extra instance values. + @example _instSettings: function(elem, options) { + return {nav: elem.find(options.navSelector)}; + } */ + _instSettings: function(elem, options) { + return {}; + }, + + /** Plugin specific post initialisation. + Override this in a sub-class to perform extra activities. + @param elem {jQuery} The current jQuery element. + @param inst {object} The instance settings. + @example _postAttach: function(elem, inst) { + elem.on('click.' + this.name, function() { + ... + }); + } */ + _postAttach: function(elem, inst) { + }, + + /** Retrieve metadata configuration from the element. + Metadata is specified as an attribute: + data-<plugin name>="<setting name>: '<value>', ...". + Dates should be specified as strings in this format: 'new Date(y, m-1, d)'. + @private + @param elem {jQuery} The source element. + @return {object} The inline configuration or {}. */ + _getMetadata: function(elem) { + try { + var data = elem.data(this.name.toLowerCase()) || ''; + data = data.replace(/'/g, '"'); + data = data.replace(/([a-zA-Z0-9]+):/g, function(match, group, i) { + var count = data.substring(0, i).match(/"/g); // Handle embedded ':' + return (!count || count.length % 2 === 0 ? '"' + group + '":' : group + ':'); + }); + data = $.parseJSON('{' + data + '}'); + for (var name in data) { // Convert dates + var value = data[name]; + if (typeof value === 'string' && value.match(/^new Date\((.*)\)$/)) { + data[name] = eval(value); + } + } + return data; + } + catch (e) { + return {}; + } + }, + + /** Retrieve the instance data for element. + @param elem {Element} The source element. + @return {object} The instance data or {}. */ + _getInst: function(elem) { + return $(elem).data(this.name) || {}; + }, + + /** Retrieve or reconfigure the settings for a plugin. + @param elem {Element} The source element. + @param name {object|string} The collection of new option values or the name of a single option. + @param [value] {any} The value for a single named option. + @return {any|object} If retrieving a single value or all options. + @example $(selector).plugin('option', 'name', value) + $(selector).plugin('option', {name: value, ...}) + var value = $(selector).plugin('option', 'name') + var options = $(selector).plugin('option') */ + option: function(elem, name, value) { + elem = $(elem); + var inst = elem.data(this.name); + if (!name || (typeof name === 'string' && value == null)) { + var options = (inst || {}).options; + return (options && name ? options[name] : options); + } + if (!elem.hasClass(this._getMarker())) { + return; + } + var options = name || {}; + if (typeof name === 'string') { + options = {}; + options[name] = value; + } + this._optionsChanged(elem, inst, options); + $.extend(inst.options, options); + }, + + /** Plugin specific options processing. + Old value available in inst.options[name], new value in options[name]. + Override this in a sub-class to perform extra activities. + @param elem {jQuery} The current jQuery element. + @param inst {object} The instance settings. + @param options {object} The new options. + @example _optionsChanged: function(elem, inst, options) { + if (options.name != inst.options.name) { + elem.removeClass(inst.options.name).addClass(options.name); + } + } */ + _optionsChanged: function(elem, inst, options) { + }, + + /** Remove all trace of the plugin. + Override _preDestroy for plugin-specific processing. + @param elem {Element} The source element. + @example $(selector).plugin('destroy') */ + destroy: function(elem) { + elem = $(elem); + if (!elem.hasClass(this._getMarker())) { + return; + } + this._preDestroy(elem, this._getInst(elem)); + elem.removeData(this.name).removeClass(this._getMarker()); + }, + + /** Plugin specific pre destruction. + Override this in a sub-class to perform extra activities and undo everything that was + done in the _postAttach or _optionsChanged functions. + @param elem {jQuery} The current jQuery element. + @param inst {object} The instance settings. + @example _preDestroy: function(elem, inst) { + elem.off('.' + this.name); + } */ + _preDestroy: function(elem, inst) { + } + }); + + /** Convert names from hyphenated to camel-case. + @private + @param value {string} The original hyphenated name. + @return {string} The camel-case version. */ + function camelCase(name) { + return name.replace(/-([a-z])/g, function(match, group) { + return group.toUpperCase(); + }); + } + + /** Expose the plugin base. + @namespace "$.JQPlugin" */ + $.JQPlugin = { + + /** Create a new collection plugin. + @memberof "$.JQPlugin" + @param [superClass='JQPlugin'] {string} The name of the parent class to inherit from. + @param overrides {object} The property/function overrides for the new class. + @example $.JQPlugin.createPlugin({ + name: 'tabs', + defaultOptions: {selectedClass: 'selected'}, + _initSettings: function(elem, options) { return {...}; }, + _postAttach: function(elem, inst) { ... } + }); */ + createPlugin: function(superClass, overrides) { + if (typeof superClass === 'object') { + overrides = superClass; + superClass = 'JQPlugin'; + } + superClass = camelCase(superClass); + var className = camelCase(overrides.name); + JQClass.classes[className] = JQClass.classes[superClass].extend(overrides); + new JQClass.classes[className](); + } + }; + +})(jQuery); \ No newline at end of file diff --git a/culturefeed_entry_ui/js/maxlength/jquery.plugin.min.js b/culturefeed_entry_ui/js/maxlength/jquery.plugin.min.js new file mode 100644 index 00000000..2323e543 --- /dev/null +++ b/culturefeed_entry_ui/js/maxlength/jquery.plugin.min.js @@ -0,0 +1,4 @@ +/** Abstract base class for collection plugins v1.0.1. + Written by Keith Wood (kbwood{at}iinet.com.au) December 2013. + Licensed under the MIT (https://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) license. */ +(function(){var j=false;window.JQClass=function(){};JQClass.classes={};JQClass.extend=function extender(f){var g=this.prototype;j=true;var h=new this();j=false;for(var i in f){h[i]=typeof f[i]=='function'&&typeof g[i]=='function'?(function(d,e){return function(){var b=this._super;this._super=function(a){return g[d].apply(this,a||[])};var c=e.apply(this,arguments);this._super=b;return c}})(i,f[i]):f[i]}function JQClass(){if(!j&&this._init){this._init.apply(this,arguments)}}JQClass.prototype=h;JQClass.prototype.constructor=JQClass;JQClass.extend=extender;return JQClass}})();(function($){JQClass.classes.JQPlugin=JQClass.extend({name:'plugin',defaultOptions:{},regionalOptions:{},_getters:[],_getMarker:function(){return'is-'+this.name},_init:function(){$.extend(this.defaultOptions,(this.regionalOptions&&this.regionalOptions[''])||{});var c=camelCase(this.name);$[c]=this;$.fn[c]=function(a){var b=Array.prototype.slice.call(arguments,1);if($[c]._isNotChained(a,b)){return $[c][a].apply($[c],[this[0]].concat(b))}return this.each(function(){if(typeof a==='string'){if(a[0]==='_'||!$[c][a]){throw'Unknown method: '+a;}$[c][a].apply($[c],[this].concat(b))}else{$[c]._attach(this,a)}})}},setDefaults:function(a){$.extend(this.defaultOptions,a||{})},_isNotChained:function(a,b){if(a==='option'&&(b.length===0||(b.length===1&&typeof b[0]==='string'))){return true}return $.inArray(a,this._getters)>-1},_attach:function(a,b){a=$(a);if(a.hasClass(this._getMarker())){return}a.addClass(this._getMarker());b=$.extend({},this.defaultOptions,this._getMetadata(a),b||{});var c=$.extend({name:this.name,elem:a,options:b},this._instSettings(a,b));a.data(this.name,c);this._postAttach(a,c);this.option(a,b)},_instSettings:function(a,b){return{}},_postAttach:function(a,b){},_getMetadata:function(d){try{var f=d.data(this.name.toLowerCase())||'';f=f.replace(/'/g,'"');f=f.replace(/([a-zA-Z0-9]+):/g,function(a,b,i){var c=f.substring(0,i).match(/"/g);return(!c||c.length%2===0?'"'+b+'":':b+':')});f=$.parseJSON('{'+f+'}');for(var g in f){var h=f[g];if(typeof h==='string'&&h.match(/^new Date\((.*)\)$/)){f[g]=eval(h)}}return f}catch(e){return{}}},_getInst:function(a){return $(a).data(this.name)||{}},option:function(a,b,c){a=$(a);var d=a.data(this.name);if(!b||(typeof b==='string'&&c==null)){var e=(d||{}).options;return(e&&b?e[b]:e)}if(!a.hasClass(this._getMarker())){return}var e=b||{};if(typeof b==='string'){e={};e[b]=c}this._optionsChanged(a,d,e);$.extend(d.options,e)},_optionsChanged:function(a,b,c){},destroy:function(a){a=$(a);if(!a.hasClass(this._getMarker())){return}this._preDestroy(a,this._getInst(a));a.removeData(this.name).removeClass(this._getMarker())},_preDestroy:function(a,b){}});function camelCase(c){return c.replace(/-([a-z])/g,function(a,b){return b.toUpperCase()})}$.JQPlugin={createPlugin:function(a,b){if(typeof a==='object'){b=a;a='JQPlugin'}a=camelCase(a);var c=camelCase(b.name);JQClass.classes[c]=JQClass.classes[a].extend(b);new JQClass.classes[c]()}}})(jQuery); \ No newline at end of file diff --git a/culturefeed_entry_ui/js/maxlength/maxlengthBasic.html b/culturefeed_entry_ui/js/maxlength/maxlengthBasic.html new file mode 100644 index 00000000..cef0ff94 --- /dev/null +++ b/culturefeed_entry_ui/js/maxlength/maxlengthBasic.html @@ -0,0 +1,26 @@ + + + + +jQuery Max Length Basics + + + + + + + +

jQuery Max Length Basics

+

This page demonstrates the very basics of the + jQuery Max Length plugin. + It contains the minimum requirements for using the plugin and + can be used as the basis for your own experimentation.

+

For more detail see the documentation reference page.

+

Default max length: +

+ + From 854474e16f7afc556e8df956e2db1ac2300a194e Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 29 Jan 2015 12:44:40 +0100 Subject: [PATCH 023/275] MSS-121 use description area --- culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc | 3 +-- culturefeed_entry_ui/js/culturefeed_entry_ui.js | 2 +- 2 files changed, 2 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 7267f059..af000c55 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -710,10 +710,9 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { '#title' => t('Short description'), '#rows' => 4, '#maxlength' => 400, - //'#description' => t('Maximum 400 characters'), + '#description' => t('Maximum 400 characters'), '#default_value' => $default_short_description, '#element_validate' => array('culturefeed_entry_ui_validate_textarea_markup'), - '#suffix' => '', ); $form['extra']['description']['ld'] = array( diff --git a/culturefeed_entry_ui/js/culturefeed_entry_ui.js b/culturefeed_entry_ui/js/culturefeed_entry_ui.js index e5c22d64..d4623feb 100644 --- a/culturefeed_entry_ui/js/culturefeed_entry_ui.js +++ b/culturefeed_entry_ui/js/culturefeed_entry_ui.js @@ -65,7 +65,7 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; attach: function (context, settings) { $('#edit-description-sd-short-description').maxlength({ max: 400, - feedbackTarget: '#edit-description-sd-short-description-maxlength-counter' + feedbackTarget: '#edit-description-sd .help-block, #edit-description-sd .description' }); } } From 8deed132f3b8a6e8d215454604e9aa96423a540d Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 29 Jan 2015 12:49:02 +0100 Subject: [PATCH 024/275] MSS-121 strip tags from default value --- culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc | 3 ++- 1 file changed, 2 insertions(+), 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 af000c55..371c148d 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -189,7 +189,8 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { $default_long_description = $event_details->getLongDescription(); $source_text = '/

(.*)<\/p>/'; $default_long_description = preg_replace($source_text, '', $default_long_description); - $default_long_description = filter_xss($default_long_description, array()); + $allowed_tags = array('a', 'em', 'strong', 'ul', 'ol', 'li', 'hr'); + $default_long_description = filter_xss($default_long_description, $allowed_tags); //$default_long_description = substr($default_long_description, 0, -169); $form_state['#ld_needed'] = TRUE; } From 95cba72635584c8ef20b53e711dcd724c2500be6 Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 29 Jan 2015 13:26:01 +0100 Subject: [PATCH 025/275] MSS-122 modify behaviour for same end date --- .../culturefeed_date_control/form/date_control.inc | 10 +++++++--- .../culturefeed_date_control/form/hybrid.inc | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/culturefeed_entry_ui/culturefeed_date_control/form/date_control.inc b/culturefeed_entry_ui/culturefeed_date_control/form/date_control.inc index 5676f49b..610948be 100644 --- a/culturefeed_entry_ui/culturefeed_date_control/form/date_control.inc +++ b/culturefeed_entry_ui/culturefeed_date_control/form/date_control.inc @@ -45,7 +45,7 @@ function culturefeed_date_control_date_control_process(array $element, array &$f '#popup_date_format' => 'd-m-Y', '#popup_date_increment' => 1, '#select_time_format' => 'H:i', - '#select_time_increment' => 30, + '#select_time_increment' => 15, '#type' => 'culturefeed_date_control_hybrid', ); @@ -58,7 +58,7 @@ function culturefeed_date_control_date_control_process(array $element, array &$f '#popup_date_format' => 'd-m-Y', '#popup_date_increment' => 1, '#select_time_format' => 'H:i', - '#select_time_increment' => 30, + '#select_time_increment' => 15, '#type' => 'culturefeed_date_control_timestamps', ); @@ -171,7 +171,11 @@ function culturefeed_date_control_date_control_validate(array $element, array &$ } // Timestamps. - if ($triggering_parent == 'add_date' || $triggering_parent == 'hour' || $triggering_parent == 'minute') { + if ( + $triggering_parent == 'add_date' || $triggering_parent == 'hour' || $triggering_parent == 'minute' || + ($triggering_parent == 'end_date' && isset($date_control['period']['start_date']) && isset($date_control['period']['end_date']) && + $date_control['period']['start_date'] == $date_control['period']['end_date']) + ) { $type = 'timestamps'; $date_control['timestamps']['stamps'] = array( diff --git a/culturefeed_entry_ui/culturefeed_date_control/form/hybrid.inc b/culturefeed_entry_ui/culturefeed_date_control/form/hybrid.inc index d6a9e470..6d8bd78f 100644 --- a/culturefeed_entry_ui/culturefeed_date_control/form/hybrid.inc +++ b/culturefeed_entry_ui/culturefeed_date_control/form/hybrid.inc @@ -88,7 +88,7 @@ function culturefeed_date_control_hybrid_process(array $element, array &$form_st $element['start_time'] = array( '#attributes' => array('class' => array('time-select-complete-minutes')), '#date_format' => 'H:i', - '#date_increment' => 30, + '#date_increment' => 15, '#default_value' => $time, '#title' => '', '#type' => 'date_select', @@ -114,7 +114,7 @@ function culturefeed_date_control_hybrid_process(array $element, array &$form_st '#attributes' => array('class' => array('time-select-complete-minutes')), '#ajax' => $ajax_settings, '#date_format' => 'H:i', - '#date_increment' => 30, + '#date_increment' => 15, '#default_value' => '', '#title' => '', '#type' => 'date_select', From 7f69e22ef19bf380278c5506d0e8d19559a4dcb9 Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 29 Jan 2015 14:33:55 +0100 Subject: [PATCH 026/275] MSS-119 enter on autocomplete --- culturefeed_entry_ui/js/culturefeed_entry_ui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/culturefeed_entry_ui/js/culturefeed_entry_ui.js b/culturefeed_entry_ui/js/culturefeed_entry_ui.js index cbbed6e1..75c225d4 100644 --- a/culturefeed_entry_ui/js/culturefeed_entry_ui.js +++ b/culturefeed_entry_ui/js/culturefeed_entry_ui.js @@ -81,7 +81,7 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; this.input.value = $(this.selected).data('autocompleteTitle'); - if (this.input.name == 'actor[location_actor_label]') { + if (this.input.name == 'location[actor][location_actor_label]') { $('#location_actor_id').val($(this.selected).data('autocompleteValue')); } From d81a944c10770a8902a844e1a584f28530fb31cf Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Thu, 29 Jan 2015 17:09:44 +0100 Subject: [PATCH 027/275] CF-393 add stans translations --- .../translations/culturefeed_entry_ui.nl.po | 668 +++++++++++------- 1 file changed, 403 insertions(+), 265 deletions(-) diff --git a/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po b/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po index b50676bc..1545bb80 100644 --- a/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po +++ b/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po @@ -1,657 +1,795 @@ +# $Id$ +# +# Dutch translation of Drupal (general) +# Copyright YEAR NAME +# Generated from files: +# culturefeed_entry_ui.module: n/a +# views/culturefeed_entry_ui.views_default.inc: n/a +# includes/culturefeed_entry_ui.pages.inc: n/a +# views/handlers/views_handler_field_cdb_item_operations.inc: n/a +# views/handlers/views_handler_area_cdb_item_create.inc: n/a +# culturefeed_entry_ui.info: n/a +# culturefeed_date_control/culturefeed_date_control.info: n/a +# culturefeed_date_control/culturefeed_date_control.module: n/a +# culturefeed_date_control/form/date_control.inc: n/a +# culturefeed_date_control/form/hybrid.inc: n/a +# culturefeed_date_control/form/timestamps.inc: n/a +# culturefeed_date_control/form/opening_times.inc: n/a +# culturefeed_date_control/form/period.inc: n/a +# culturefeed_date_control/theme/theme.inc: n/a +# includes/culturefeed_entry_ui.admin.inc: n/a +# js/bootstrap_autocomplete_override.js: n/a +# js/culturefeed_entry_ui.js: n/a +# views/culturefeed_entry_ui.views.inc: n/a +# msgid "" msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2015-01-22 16:05+0100\n" +"PO-Revision-Date: 2015-01-28 13:27+0100\n" +"Last-Translator: NAME \n" +"Language-Team: Dutch \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: POEditor.com\n" -"Project-Id-Version: CFK - translations\n" +"Plural-Forms: nplurals=2; plural=(n!=1);\n" "Language: nl\n" +"X-Generator: Poedit 1.7.4\n" -#: +#: culturefeed_entry_ui.module:18 msgid "Manage object tags" msgstr "Beheer object tags" -#: +#: culturefeed_entry_ui.module:19 msgid "Manage all the tags from the objects on culturefeed (events, actors, ...)." msgstr "Beheer alle tags van objecten op culture feed (activiteiten, actoren ...)." -#: +#: culturefeed_entry_ui.module:22 msgid "Manage custom tags" msgstr "Manage custom tags" -#: +#: culturefeed_entry_ui.module:23 msgid "Manage custom tags from the objects on culturefeed (events, actors, ...) managed on the admin section." msgstr "" -#: +#: culturefeed_entry_ui.module:26 msgid "Create events" msgstr "Events aanmaken" -#: +#: culturefeed_entry_ui.module:27 msgid "Create new events through the entity api." msgstr "Maak activiteiten aan via Entry API" -#: +#: culturefeed_entry_ui.module:30 views/culturefeed_entry_ui.views_default.inc:171 msgid "Edit events" msgstr "Events aanpassen" -#: +#: culturefeed_entry_ui.module:31 msgid "Edit events through the entity api." msgstr "Pas activiteiten aan via Entry API" -#: +#: culturefeed_entry_ui.module:34 msgid "Delete events" msgstr "Verwijder events" -#: +#: culturefeed_entry_ui.module:35 msgid "Delete events through the entity api." msgstr "Verwijder activiteiten via Entry API" -#: +#: culturefeed_entry_ui.module:135;63 includes/culturefeed_entry_ui.pages.inc:755;2508 views/handlers/views_handler_field_cdb_item_operations.inc:54 msgid "Tags" msgstr "Labels" -#: +#: culturefeed_entry_ui.module:150 views/handlers/views_handler_field_cdb_item_operations.inc:27 msgid "Edit" msgstr "Bewerken" -#: +#: culturefeed_entry_ui.module:168 msgid "View" msgstr "Weergeven" -#: -msgid "ZIP Code" -msgstr "Postcode" +#: culturefeed_entry_ui.module:375 views/handlers/views_handler_area_cdb_item_create.inc:19 +msgid "Add event" +msgstr "Voeg activiteit toe" + +#: culturefeed_entry_ui.module:401 +msgid "Some disallowed html tags will be removed in the %field_name field. The allowed tags are %allowed_tags" +msgstr "Niet toegelaten html-tags zullen verwijderd worden in het veld %field_name. De toegelaten tags zijn %allowed_tags" -#: +#: culturefeed_entry_ui.module:71 msgid "New event" msgstr "Maak nieuwe activiteit aan" -#: +#: culturefeed_entry_ui.module:79 msgid "Edit event" msgstr "Pas activiteit aan" -#: +#: culturefeed_entry_ui.module:87 msgid "Delete event" msgstr "Verwijder activiteit" -#: +#: culturefeed_entry_ui.module:95 culturefeed_entry_ui.info:0 msgid "CultureFeed Entry UI" msgstr "CultureFeed Entry UI" -#: +#: culturefeed_entry_ui.module:96 msgid "All configurations to entry api for this site" msgstr "" -#: +#: culturefeed_entry_ui.info:0 msgid "Multilingual forms to post, update and delete events to UiTDatabank Entry API" msgstr "Meertalig invoerformulier om activiteiten aan te maken, aan te passen en verwijderen in UiTdatabank via Entry API" -#: +#: culturefeed_entry_ui.info:0 culturefeed_date_control/culturefeed_date_control.info:0 msgid "CultureFeed" msgstr "CultureFeed" -#: -msgid "Preferred language" -msgstr "Voorkeur taal" - -#: -msgid "Use the preferred language of the UiTID user, with the Drupal UI language as fallback" -msgstr "Gebruik de voorkeurstaal van de UiTiD gebruiker, met de Drupal UI taal als backup" +#: culturefeed_date_control/culturefeed_date_control.module:253 +msgid "AHAH callback" +msgstr "AHAH terugkoppeling" -#: -msgid "Custom tags" +#: culturefeed_date_control/culturefeed_date_control.info:0 +msgid "CultureFeed Entry UI Date control" msgstr "" -#: -msgid "Custom tags specific for this site. Use a new line for each tag." +#: culturefeed_date_control/culturefeed_date_control.info:0 +msgid "Form element to manage dates in the Entry UI." msgstr "" -#: +#: culturefeed_date_control/form/date_control.inc:28 includes/culturefeed_entry_ui.pages.inc:671 +msgid "Dates" +msgstr "Datums" + +#: culturefeed_date_control/form/date_control.inc:87 culturefeed_date_control/form/hybrid.inc:131 +msgid "Permanent" +msgstr "Permanent" + +#: culturefeed_date_control/form/hybrid.inc:83;108 culturefeed_date_control/form/timestamps.inc:104 +msgid "Date" +msgstr "Datum" + +#: culturefeed_date_control/form/hybrid.inc:98 +msgid "+ add end date or time" +msgstr "+ voeg einddatum toe" + +#: culturefeed_date_control/form/hybrid.inc:124 culturefeed_date_control/form/timestamps.inc:143 +msgid "+ add date" +msgstr "+ voeg datum toe" + +#: culturefeed_date_control/form/opening_times.inc:24 msgid "mon" msgstr "ma" -#: +#: culturefeed_date_control/form/opening_times.inc:25 msgid "tue" msgstr "di" -#: +#: culturefeed_date_control/form/opening_times.inc:26 msgid "wed" msgstr "woe" -#: +#: culturefeed_date_control/form/opening_times.inc:27 msgid "thu" msgstr "don" -#: +#: culturefeed_date_control/form/opening_times.inc:28 msgid "fri" msgstr "vrij" -#: +#: culturefeed_date_control/form/opening_times.inc:29 msgid "sat" msgstr "zat" -#: +#: culturefeed_date_control/form/opening_times.inc:30 msgid "sun" msgstr "zon" -#: -msgid "Basic info" -msgstr "Basisgegevens" +#: culturefeed_date_control/form/opening_times.inc:36 +msgid "Yes" +msgstr "Ja" + +#: culturefeed_date_control/form/opening_times.inc:36 +msgid "No" +msgstr "Nee" + +#: culturefeed_date_control/form/opening_times.inc:37 +msgid "Open all day ?" +msgstr "De hele dag geopend?" + +#: culturefeed_date_control/form/opening_times.inc:60;67 +msgid "Format" +msgstr "Formaat" + +#: culturefeed_date_control/form/period.inc:82 +msgid "Start date" +msgstr "Begindatum" + +#: culturefeed_date_control/form/period.inc:88 +msgid "+ add end date" +msgstr "+ voeg einddatum toe" + +#: culturefeed_date_control/form/period.inc:99 +msgid "End date" +msgstr "Einddatum" + +#: culturefeed_date_control/form/period.inc:106 +msgid "- remove end date" +msgstr "- verwijder einddatum" + +#: culturefeed_date_control/form/timestamps.inc:92 +msgid "×" +msgstr "x" + +#: culturefeed_date_control/form/timestamps.inc:131 +msgid "- remove end time" +msgstr "- verwijder einduur" -#: +#: culturefeed_date_control/form/timestamps.inc:136 +msgid "+ add end time" +msgstr "+ voeg einduur toe" + +#: culturefeed_date_control/theme/theme.inc:64 +msgid "open" +msgstr "open" + +#: culturefeed_date_control/theme/theme.inc:64 +msgid "from" +msgstr "van" + +#: culturefeed_date_control/theme/theme.inc:64 +msgid "to" +msgstr "tot" + +#: includes/culturefeed_entry_ui.admin.inc:21 +msgid "Preferred language" +msgstr "Voorkeur taal" + +#: includes/culturefeed_entry_ui.admin.inc:23 +msgid "Use the preferred language of the UiTID user, with the Drupal UI language as fallback" +msgstr "Gebruik de voorkeurstaal van de UiTiD gebruiker, met de Drupal UI taal als backup" + +#: includes/culturefeed_entry_ui.admin.inc:30 +msgid "Custom options on the /tags page" +msgstr "" + +#: includes/culturefeed_entry_ui.admin.inc:32 +msgid "Custom tags specific for this site. Use a new line for each tag." +msgstr "" + +#: includes/culturefeed_entry_ui.admin.inc:37 +msgid "Custom tags to push to entry API" +msgstr "" + +#: includes/culturefeed_entry_ui.admin.inc:39 +msgid "Tags pushed under the hood to Entry API. Use a new line for each tag." +msgstr "" + +#: includes/culturefeed_entry_ui.pages.inc:374;1220;1251;1282;1313 msgid "Event title" msgstr "Titel" -#: +#: includes/culturefeed_entry_ui.pages.inc:422 msgid "Concerts" msgstr "Concerten" -#: +#: includes/culturefeed_entry_ui.pages.inc:443 msgid "Dance" msgstr "Dansvoorstelling" -#: +#: includes/culturefeed_entry_ui.pages.inc:464 msgid "Film" msgstr "Film" -#: +#: includes/culturefeed_entry_ui.pages.inc:488 msgid "Theatre" msgstr "Theatervoorstelling" -#: +#: includes/culturefeed_entry_ui.pages.inc:510 msgid "Sport" msgstr "Sport" -#: +#: includes/culturefeed_entry_ui.pages.inc:545 msgid "Location" msgstr "Locatie" -#: +#: includes/culturefeed_entry_ui.pages.inc:578 msgid "Location not found, add location" msgstr "Locatie niet gevonden, voeg locatie toe" -#: +#: includes/culturefeed_entry_ui.pages.inc:599 msgid "Location Title" msgstr "Naam locatie" -#: -msgid "Street" -msgstr "Straat" - -#: -msgid "House Number" -msgstr "Huisnummer" - -#: -msgid "City" -msgstr "Stad of gemeente" - -#: +#: includes/culturefeed_entry_ui.pages.inc:614 msgid "Country" msgstr "Land" -#: -msgid "Dates" -msgstr "Datums" - -#: -msgid "Permanent" -msgstr "Permanent" - -#: -msgid "remove date" -msgstr "datum verwijderen" - -#: -msgid "Date" -msgstr "Begindatum" - -#: -msgid "+ add end date or time" -msgstr "+ voeg einddatum toe" - -#: -msgid "End date" -msgstr "Einddatum" - -#: -msgid "remove end date" -msgstr "verwijder einddatum" +#: includes/culturefeed_entry_ui.pages.inc:627 +msgid "ZIP Code" +msgstr "Postcode" -#: -msgid "+ add date" -msgstr "+ voeg datum toe" +#: includes/culturefeed_entry_ui.pages.inc:640 +msgid "City" +msgstr "Stad of gemeente" -#: -msgid "Open all day?" -msgstr "Alle dagen open?" +#: includes/culturefeed_entry_ui.pages.inc:649 +msgid "Street" +msgstr "Straat" -#: -msgid "Yes" -msgstr "Ja" +#: includes/culturefeed_entry_ui.pages.inc:649 +msgid "Street and House Number" +msgstr "Straat en huisnummer" -#: -msgid "No" -msgstr "Nee" +#: includes/culturefeed_entry_ui.pages.inc:657 +msgid "House Number" +msgstr "Huisnummer" -#: +#: includes/culturefeed_entry_ui.pages.inc:688 msgid "Extra info" msgstr "Extra info" -#: +#: includes/culturefeed_entry_ui.pages.inc:696;704;722 msgid "Description" msgstr "Beschrijving" -#: +#: includes/culturefeed_entry_ui.pages.inc:709;1226;1257;1288;1319 msgid "Short description" msgstr "Korte omschrijving" -#: +#: includes/culturefeed_entry_ui.pages.inc:712 +msgid "Maximum 400 characters" +msgstr "Maximum 400 karakters" + +#: includes/culturefeed_entry_ui.pages.inc:730 msgid "+ add long description" msgstr "+ voeg lange beschrijving toe" -#: +#: includes/culturefeed_entry_ui.pages.inc:745;1233;1264;1295;1326 msgid "Long description" msgstr "Lange beschrijving" -#: +#: includes/culturefeed_entry_ui.pages.inc:756 msgid "Add multiple tags seperated by a \";\"" msgstr "Voeg meerdere trefwoorden toe, gescheiden met een \";\"" -#: +#: includes/culturefeed_entry_ui.pages.inc:766 msgid "Links" msgstr "Links" -#: +#: includes/culturefeed_entry_ui.pages.inc:797 msgid "+ add another link" msgstr "+ voeg een link toe" -#: +#: includes/culturefeed_entry_ui.pages.inc:814 msgid "Image" msgstr "Afbeelding" -#: +#: includes/culturefeed_entry_ui.pages.inc:820 msgid "Image upload" msgstr "Afbeelding opladen" -#: +#: includes/culturefeed_entry_ui.pages.inc:822 msgid "Allowed extensions: gif png jpg jpeg" msgstr "Ondersteunde bestandsformaten: gif, png, jpg, jpeg" -#: -msgid "I agree to the terms & conditions and I declare that I have the necessary rights or permissions to distribute the image." -msgstr "Ik ga akkoord met de algemene voorwaarden van UiTdatabank en verklaar dat ik over de nodige rechten beschik om de afbeelding te verspreiden." +#: includes/culturefeed_entry_ui.pages.inc:847 +msgid "I agree to the terms & conditions and I declare that I have the necessary rights or permissions to distribute the image." +msgstr "" +"Ik ga akkoord met de algemene voorwaarden van UiTdatabank en verklaar dat ik over de nodige rechten beschik om de afbeelding " +"te verspreiden." -#: +#: includes/culturefeed_entry_ui.pages.inc:854;859;891 msgid "Price" msgstr "Prijs" -#: +#: includes/culturefeed_entry_ui.pages.inc:874 msgid "Free event" msgstr "Gratis activiteit" -#: +#: includes/culturefeed_entry_ui.pages.inc:898 msgid "+ add conditions & discounts" msgstr "+ voeg voorwaarden en kortingen toe" -#: +#: includes/culturefeed_entry_ui.pages.inc:925 msgid "Price conditions & discounts" msgstr "Prijsvoorwaarden & kortingen" -#: +#: includes/culturefeed_entry_ui.pages.inc:954 msgid "Organizer" msgstr "Organisator" -#: +#: includes/culturefeed_entry_ui.pages.inc:978 msgid "Organizer not found, add organizer" msgstr "Organisator niet gevonden, voeg organisator toe" -#: +#: includes/culturefeed_entry_ui.pages.inc:995 msgid "Name new organizer" msgstr "Naam nieuwe organisator" -#: +#: includes/culturefeed_entry_ui.pages.inc:1002 msgid "Age" msgstr "Leeftijd" -#: +#: includes/culturefeed_entry_ui.pages.inc:1004 msgid "For everyone" msgstr "Voor iedereen" -#: +#: includes/culturefeed_entry_ui.pages.inc:1005 msgid "For children (between 1 and 12 years)" msgstr "Voor kinderen (tussen 1 en 12 jaar)" -#: +#: includes/culturefeed_entry_ui.pages.inc:1006 msgid "For youth (between 12 and 18 years)" msgstr "Voor jongeren (tussen 12 en 18 jaar)" -#: +#: includes/culturefeed_entry_ui.pages.inc:1007 msgid "For adults (18+)" msgstr "Voor volwassenen (18+)" -#: +#: includes/culturefeed_entry_ui.pages.inc:1013 msgid "Suitable for ages from" msgstr "Geschikt voor leeftijden vanaf" -#: +#: includes/culturefeed_entry_ui.pages.inc:1036 msgid "Activities for children will get the 'Fly' label" msgstr "Activiteiten voor kinderen krijgen automatisch het 'Vlieg'-label" -#: +#: includes/culturefeed_entry_ui.pages.inc:1047;1491 msgid "Contact" -msgstr "Contactgegevens" +msgstr "Contact" -#: +#: includes/culturefeed_entry_ui.pages.inc:1080 msgid "+ add contact option" msgstr "+ voeg contactgegevens toe" -#: +#: includes/culturefeed_entry_ui.pages.inc:1094 msgid "Performers" msgstr "Uitvoerders" -#: +#: includes/culturefeed_entry_ui.pages.inc:1129 msgid "+ add another performer" msgstr "+ voeg nog een uitvoerder toe" -#: +#: includes/culturefeed_entry_ui.pages.inc:1143;1445 msgid "Language" msgstr "Taal" -#: +#: includes/culturefeed_entry_ui.pages.inc:1176 msgid "+ add more language info" msgstr "+ voeg meer taalinformatie toe" -#: +#: includes/culturefeed_entry_ui.pages.inc:1191 msgid "Access" msgstr "Toegang" -#: +#: includes/culturefeed_entry_ui.pages.inc:1197 msgid "Open for everyone" msgstr "Voor iedereen toegankelijk" -#: +#: includes/culturefeed_entry_ui.pages.inc:1197 msgid "Only for members" msgstr "Enkel voor leden" -#: +#: includes/culturefeed_entry_ui.pages.inc:1204 msgid "Translations" msgstr "Vertalingen" -#: +#: includes/culturefeed_entry_ui.pages.inc:1212;1462 msgid "Dutch" msgstr "Nederlands" -#: +#: includes/culturefeed_entry_ui.pages.inc:1243;1460 msgid "English" msgstr "Engels" -#: +#: includes/culturefeed_entry_ui.pages.inc:1274;1464 msgid "French" msgstr "Frans" -#: +#: includes/culturefeed_entry_ui.pages.inc:1305;1463 msgid "German" msgstr "Duits" -#: +#: includes/culturefeed_entry_ui.pages.inc:1334 msgid "Publication date" msgstr "Publicatiedatum" -#: +#: includes/culturefeed_entry_ui.pages.inc:1358 msgid "Save" msgstr "Opslaan" -#: -msgid "Start time" -msgstr "Starttijd" - -#: -msgid "End time" -msgstr "Eindtijd" - -#: +#: includes/culturefeed_entry_ui.pages.inc:1448 msgid "Spoken" msgstr "Gesproken" -#: +#: includes/culturefeed_entry_ui.pages.inc:1449 msgid "Dubbed" msgstr "Gedubd" -#: +#: includes/culturefeed_entry_ui.pages.inc:1450 msgid "Subtitled" msgstr "Ondertiteld" -#: +#: includes/culturefeed_entry_ui.pages.inc:1457 msgid "in" msgstr "in" -#: -msgid "Contact" -msgstr "Contact" - -#: +#: includes/culturefeed_entry_ui.pages.inc:1500 msgid "Input" msgstr "Invoer" -#: +#: includes/culturefeed_entry_ui.pages.inc:1516 msgid "Performer" msgstr "Uitvoerder" -#: +#: includes/culturefeed_entry_ui.pages.inc:1524 msgid "Role" msgstr "Rol" -#: +#: includes/culturefeed_entry_ui.pages.inc:1539 msgid "Link" msgstr "Link" -#: +#: includes/culturefeed_entry_ui.pages.inc:1546 msgid "for reservation" msgstr "voor reservatie" -#: -msgid "Format" -msgstr "Formaat" - -#: +#: includes/culturefeed_entry_ui.pages.inc:1562 msgid "Please fill in correct age" msgstr "Geef de juiste leeftijd op" -#: +#: includes/culturefeed_entry_ui.pages.inc:1579;1609 msgid "Please fill in correct date and time" msgstr "Geef de juiste datum en tijdstip op" -#: -msgid "A date is required." -msgstr "Een datum is verplicht." - -#: +#: includes/culturefeed_entry_ui.pages.inc:1586 msgid "Date field is invalid. The end date is earlier than the beginning date." msgstr "Ingevoerde datum niet correct: einddatum valt voor de begindatum" -#: +#: includes/culturefeed_entry_ui.pages.inc:1616 msgid "Date field is invalid. The end time is earlier than the beginning time." msgstr "Ingevoerde datum niet correct: einduur valt voor beginuur" -#: -msgid "Please fill in correct date" -msgstr "Voer correcte datum in" +#: includes/culturefeed_entry_ui.pages.inc:1650;1657 +msgid "Please fill in correct time." +msgstr "Geef de juiste datum en tijdstip op" -#: +#: includes/culturefeed_entry_ui.pages.inc:1672 msgid "Please agree to the general conditions of UiTdatabank and declare that you have the necessary rights or permissions to distribute the image through UiTdatabank." msgstr "Geef aan dat je akkoord gaat met de algemene voorwaarden van UiTdatabank en dat je over de nodige rechten of toestemmingen beschikt om de afbeelding te verspreiden via UiTdatabank." -#: +#: includes/culturefeed_entry_ui.pages.inc:1677 msgid "A category is required." msgstr "Een categorie is verplicht" -#: +#: includes/culturefeed_entry_ui.pages.inc:1683 msgid "A title is required for a custom location" msgstr "Een titel is verplicht voor een nieuwe locatie" -#: -msgid "A zip code is required for a custom location" -msgstr "Een postcode is verplicht voor een nieuwe locatie" - -#: +#: includes/culturefeed_entry_ui.pages.inc:1691 msgid "A city is required for a custom location" msgstr "Een stad is verplicht voor een nieuwe locatie" -#: +#: includes/culturefeed_entry_ui.pages.inc:1698 msgid "A location is required." msgstr "Een locatie is verplicht" -#: +#: includes/culturefeed_entry_ui.pages.inc:1703;1707 msgid "We could not validate the location" msgstr "We kunnen de locatie niet bevestigen" -#: +#: includes/culturefeed_entry_ui.pages.inc:1746 msgid "Not a valid URL" msgstr "Geen geldige URL" -#: +#: includes/culturefeed_entry_ui.pages.inc:1758;1762 msgid "We could not validate the organizer" msgstr "We kunnen de organisatie niet bevestigen" -#: +#: includes/culturefeed_entry_ui.pages.inc:1778 msgid "Not a valid email address" msgstr "Geen geldig emailadres" -#: +#: includes/culturefeed_entry_ui.pages.inc:1797 +msgid "If you translate something, you should also translate the title." +msgstr "Als je een vertaling toevoegt, moet je ook de titel vertalen." + +#: includes/culturefeed_entry_ui.pages.inc:1935 msgid "Order tickets" msgstr "Bestel tickets" -#: +#: includes/culturefeed_entry_ui.pages.inc:2313 msgid "An error occurred while saving the event" msgstr "Er is een fout opgetreden tijdens het opslaan van de activiteit" -#: -msgid "Event successfully updated" -msgstr "Activiteit werd aangepast" +#: includes/culturefeed_entry_ui.pages.inc:2414 +msgid "Saving the event" +msgstr "gfh" + +#: includes/culturefeed_entry_ui.pages.inc:2421 +msgid "Initializing." +msgstr "Aan het initialiseren." -#: -msgid "Click here to update" -msgstr "Klik hier om aan te passen" +#: includes/culturefeed_entry_ui.pages.inc:2422 +msgid "Completed @current of @total." +msgstr "@current van @total gereed." -#: +#: includes/culturefeed_entry_ui.pages.inc:2440 msgid "Are you sure you want to delete the event?" msgstr "Ben je zeker dat je de activiteit wil verwijderen?" -#: +#: includes/culturefeed_entry_ui.pages.inc:2442 msgid "This action cannot be undone" msgstr "Deze actie kan niet ongedaan gemaakt worden" -#: +#: includes/culturefeed_entry_ui.pages.inc:2443 views/handlers/views_handler_field_cdb_item_operations.inc:31 msgid "Delete" msgstr "Verwijder" -#: +#: includes/culturefeed_entry_ui.pages.inc:2444 msgid "Cancel" msgstr "Annuleren" -#: +#: includes/culturefeed_entry_ui.pages.inc:2456 msgid "Event successfully deleted" msgstr "Activiteit werd verwijderd" -#: +#: includes/culturefeed_entry_ui.pages.inc:2460 msgid "An error occurred while deleting the event" msgstr "Er is een fout opgetreden tijdens het verwijderen van de activiteit" -#: +#: includes/culturefeed_entry_ui.pages.inc:2501 +msgid "Custom tags" +msgstr "" + +#: includes/culturefeed_entry_ui.pages.inc:2510 msgid "Seperate multiple tags by ;" msgstr "Scheid meerdere trefwoorden met ;" -#: +#: includes/culturefeed_entry_ui.pages.inc:2515 views/culturefeed_entry_ui.views_default.inc:31;160 msgid "Submit" msgstr "Voeg toe" -#: +#: includes/culturefeed_entry_ui.pages.inc:2530 msgid "Tag @tag is not permitted because it's already a custom tag." msgstr "Trefwoord @tag is niet toegelaten aangezien het al een bestaande marker is." -#: -msgid "Autocomplete popup" -msgstr "Popup voor automatisch aanvullen" +#: includes/culturefeed_entry_ui.pages.inc:2577 +msgid "The tags were adjusted. However, it takes half an hour before these changes on all channels (including Uitinvlaanderen) will be. Available under the \"View\" tab" +msgstr "De labels werden aangepast. Het kan echter een half uur duren vooraleer deze wijzigingen op alle kanalen (waaronder UiTinVlaanderen) zichtbaar zijn." -#: -msgid "open" -msgstr "open" +#: includes/culturefeed_entry_ui.pages.inc:2582 +msgid "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\"." +msgstr "Je hebt niet de juiste rechten om dit trefwoord toe te voegen. Als je hier vragen bij hebt, contacteer dan onze helpdesk via \"vragen@uitdatabank.be\"." -#: -msgid "from" -msgstr "van" +#: includes/culturefeed_entry_ui.pages.inc:2585 +msgid "Error occured while saving the tags" +msgstr "Er is een fout opgetreden tijdens het opslaan van de labels" -#: -msgid "to" -msgstr "tot" +#: includes/culturefeed_entry_ui.pages.inc:2659 +msgid "The event %title has been created." +msgstr "De activiteit %title werd aangemaakt." + +#: includes/culturefeed_entry_ui.pages.inc:2660 +msgid "The event %title has been updated." +msgstr "Het event %title werd aangepast." + +#: includes/culturefeed_entry_ui.pages.inc:2301;2306 +msgid "culturefeed_entry_ui" +msgstr "" + +#: includes/culturefeed_entry_ui.pages.inc:2301 +msgid "Event %eventid updated." +msgstr "" + +#: includes/culturefeed_entry_ui.pages.inc:2306 +msgid "Event %eventid created." +msgstr "" + +#: js/bootstrap_autocomplete_override.js:0 js/culturefeed_entry_ui.js:0 +msgid "Autocomplete popup" +msgstr "Popup voor automatisch aanvullen" -#: +#: views/culturefeed_entry_ui.views.inc:13 msgid "Operations" msgstr "Bewerkingen" -#: +#: views/culturefeed_entry_ui.views.inc:14 msgid "Links to operations that can be performed" msgstr "Link naar mogelijke handelingen" -#: +#: views/culturefeed_entry_ui.views.inc:20 msgid "Create event" msgstr "Maak activiteit aan" -#: +#: views/culturefeed_entry_ui.views.inc:21 msgid "Link to create event" msgstr "Link om activiteit aan te maken" -#: +#: views/culturefeed_entry_ui.views_default.inc:25 +msgid "More" +msgstr "Meer" + +#: views/culturefeed_entry_ui.views_default.inc:32;161 +msgid "Reset" +msgstr "Opnieuw instellen" + +#: views/culturefeed_entry_ui.views_default.inc:33;162 +msgid "Sort on" +msgstr "Sorteer op" + +#: views/culturefeed_entry_ui.views_default.inc:34;163 +msgid "Ascending" +msgstr "Oplopend" + +#: views/culturefeed_entry_ui.views_default.inc:35;164 +msgid "Descending" +msgstr "Aflopend" + +#: views/culturefeed_entry_ui.views_default.inc:157 msgid "Master" msgstr "" -#: +#: views/culturefeed_entry_ui.views_default.inc:158 msgid "Events created by me" msgstr "Mijn activiteiten" -#: +#: views/culturefeed_entry_ui.views_default.inc:159 msgid "more" msgstr "meer" -#: -msgid "Apply" -msgstr "Pas toe" - -#: -msgid "Reset" -msgstr "Opnieuw instellen" - -#: -msgid "Sort by" -msgstr "Sorteer op" - -#: -msgid "Asc" -msgstr "Stijgend" - -#: -msgid "Desc" -msgstr "Dalend" - -#: +#: views/culturefeed_entry_ui.views_default.inc:165 msgid "Notification that no results were found" msgstr "Melding dat er geen resultaten werden gevonden" -#: +#: views/culturefeed_entry_ui.views_default.inc:166 msgid "Unable to find any events created by you." msgstr "Er werden geen activiteiten gevonden die door jou aangemaakt werden" -#: +#: views/culturefeed_entry_ui.views_default.inc:167 msgid "Last updated" msgstr "Laatst bijgewerkt" -#: +#: views/culturefeed_entry_ui.views_default.inc:168 +msgid "Created by current user" +msgstr "" + +#: views/culturefeed_entry_ui.views_default.inc:169 msgid "Block" msgstr "Blok" -#: -msgid "Add event" -msgstr "Voeg activiteit toe" +#: views/culturefeed_entry_ui.views_default.inc:170 +msgid "Page" +msgstr "Pagina" +#: views/culturefeed_entry_ui.views_default.inc:172 +msgid "Items per page" +msgstr "" + +#: views/culturefeed_entry_ui.views_default.inc:173 +msgid "- All -" +msgstr "" + +#: views/culturefeed_entry_ui.views_default.inc:174 +msgid "Start" +msgstr "" + +#: views/culturefeed_entry_ui.views_default.inc:175 +msgid "« first" +msgstr "« eerste" + +#: views/culturefeed_entry_ui.views_default.inc:176 +msgid "‹ previous" +msgstr "‹ vorige" + +#: views/culturefeed_entry_ui.views_default.inc:177 +msgid "next ›" +msgstr "volgende ›" + +#: views/culturefeed_entry_ui.views_default.inc:178 +msgid "last »" +msgstr "laatste »" + +#: views/handlers/views_handler_field_cdb_item_operations.inc:47 +msgid "No permission to edit event" +msgstr "" From 7ff7c152e5186fb8af72b660fdd9e6e82b8a7537 Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 29 Jan 2015 21:54:05 +0100 Subject: [PATCH 028/275] MSS-119 6. autocomplete and space --- .../js/bootstrap_autocomplete_override.js | 62 ++++++++++++++++++- .../js/culturefeed_entry_ui.js | 49 +++++++++++++++ 2 files changed, 108 insertions(+), 3 deletions(-) diff --git a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js index 4d2b2666..4492dacf 100644 --- a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js +++ b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js @@ -1,5 +1,4 @@ - -(function ($) { +jQuery(function($) { /** * Fills the suggestion popup with any matches received. @@ -70,4 +69,61 @@ } }; -})(jQuery); + if (Drupal.ACDB) { + + /** + * Performs a cached and delayed search. + * Custom override: Don't show an error when people are navigation away of the site. + * + */ + Drupal.ACDB.prototype.search = function (searchString) { + var db = this; + searchString = searchString.replace(/^\s+|\s+$/, ''); + this.searchString = searchString; + + // See if this string needs to be searched for anyway. + if (searchString.length <= 0 || + searchString.charAt(searchString.length - 1) == ',') { + return; + } + + // See if this key has been searched for before. + if (this.cache[searchString]) { + return this.owner.found(this.cache[searchString]); + } + + // Initiate delayed search. + if (this.timer) { + clearTimeout(this.timer); + } + this.timer = setTimeout(function () { + db.owner.setStatus('begin'); + + // Ajax GET request for autocompletion. We use Drupal.encodePath instead of + // encodeURIComponent to allow autocomplete search terms to contain slashes. + $.ajax({ + type: 'GET', + url: db.uri + '/' + Drupal.encodePath(searchString), + dataType: 'json', + success: function (matches) { + if (typeof matches.status == 'undefined' || matches.status != 0) { + db.cache[searchString] = matches; + // Verify if these are still the matches the user wants to see. + if (db.searchString == searchString) { + db.owner.found(matches); + } + db.owner.setStatus('found'); + } + }, + error: function (xmlhttp) { + if (xmlhttp.status) { + alert(Drupal.ajaxError(xmlhttp, db.uri)); + } + } + }); + }, this.delay); + }; + + } + +}); diff --git a/culturefeed_entry_ui/js/culturefeed_entry_ui.js b/culturefeed_entry_ui/js/culturefeed_entry_ui.js index 62ee1798..8dd5050e 100644 --- a/culturefeed_entry_ui/js/culturefeed_entry_ui.js +++ b/culturefeed_entry_ui/js/culturefeed_entry_ui.js @@ -221,4 +221,53 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; } }; + /** + * Performs a cached and delayed search. + */ + Drupal.ACDB.prototype.search = function (searchString) {console.log(searchString); + var db = this; + searchString = searchString.replace(/^\s+|\s+$/, ''); + this.searchString = searchString; + + // See if this string needs to be searched for anyway. + if (searchString.length <= 0 || + searchString.charAt(searchString.length - 1) == ',') { + return; + } + + // See if this key has been searched for before. + if (this.cache[searchString]) { + return this.owner.found(this.cache[searchString]); + } + + // Initiate delayed search. + if (this.timer) { + clearTimeout(this.timer); + } + this.timer = setTimeout(function () { + db.owner.setStatus('begin'); + + // Ajax GET request for autocompletion. We use Drupal.encodePath instead of + // encodeURIComponent to allow autocomplete search terms to contain slashes. + $.ajax({ + type: 'GET', + url: db.uri + '/' + Drupal.encodePath(searchString), + dataType: 'json', + success: function (matches) { + if (typeof matches.status == 'undefined' || matches.status != 0) { + db.cache[searchString] = matches; + // Verify if these are still the matches the user wants to see. + //if (db.searchString == searchString) { + db.owner.found(matches); + //} + db.owner.setStatus('found'); + } + }, + error: function (xmlhttp) { + alert(Drupal.ajaxError(xmlhttp, db.uri)); + } + }); + }, this.delay); + }; + })(jQuery); From a8bd072544f0e22e2d58622b752e3507afbf6c1d Mon Sep 17 00:00:00 2001 From: HnLn Date: Tue, 3 Feb 2015 14:30:45 +0100 Subject: [PATCH 029/275] MSS-119 7. city validation --- .../includes/culturefeed_entry_ui.pages.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 27632401..ee8ff712 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -1706,6 +1706,12 @@ function culturefeed_entry_ui_event_save_validate($form, &$form_state) { if (empty($values['location']['new']['citywrapper']['city'])) { form_set_error('city', t('A city is required for a custom location')); } + else { + $available_city = culturefeed_search_get_city_suggestions($values['location']['new']['citywrapper']['city'], TRUE); + if (!isset($available_city[$values['location']['new']['citywrapper']['city']])) { + form_set_error('location', t('A valid location is required.')); + } + } $location = NULL; } else { From 5672096f06ee02a2e1f8fb410a2c36a195104014 Mon Sep 17 00:00:00 2001 From: HnLn Date: Tue, 3 Feb 2015 15:12:04 +0100 Subject: [PATCH 030/275] MSS-19 8. autocomplete zipcode --- culturefeed_search/includes/pages.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/culturefeed_search/includes/pages.inc b/culturefeed_search/includes/pages.inc index d0fdadb9..dc55974e 100644 --- a/culturefeed_search/includes/pages.inc +++ b/culturefeed_search/includes/pages.inc @@ -47,7 +47,7 @@ function culturefeed_search_suggestions_autocomplete_page($search_string, $past $title = $location_title = check_plain($suggestion->value); $location = $suggestion->zipcode; if (!empty($location)) { - $location_title .= ' - (' . $location->zipcode . ')'; + $location_title .= ' - (' . $location . ')'; } $object = new stdClass(); $object->title = $title; From 5318fd902fd946f9ce5cc3ed79acac9e00fce877 Mon Sep 17 00:00:00 2001 From: HnLn Date: Tue, 3 Feb 2015 15:16:38 +0100 Subject: [PATCH 031/275] MSS-119 also fix bootstrap override to use locationTitle --- culturefeed_entry_ui/js/bootstrap_autocomplete_override.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js index 4492dacf..4e1b66b8 100644 --- a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js +++ b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js @@ -30,7 +30,7 @@ jQuery(function($) { .appendTo(ul); } else if (typeof(matches[key]) == "object") { - value = matches[key].title; + value = matches[key].locationTitle; $('

  • ') .html($('').html(value).click(function (e) { e.preventDefault(); })) .mousedown(function () { ac.select(this); }) From 731a83d7a300a1fc317eb5b3a0b6627ba26590b2 Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Tue, 10 Feb 2015 11:24:25 +0100 Subject: [PATCH 032/275] fix valid location error when country != BE --- .../includes/culturefeed_entry_ui.pages.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index ee8ff712..f62af5d9 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -1698,18 +1698,18 @@ function culturefeed_entry_ui_event_save_validate($form, &$form_state) { if (empty($values['location']['new']['location_title'])) { form_set_error('location_title', t('A title is required for a custom location')); } - /*if ($values['location']['new']['citywrapper']['country_select'] != 'BE') { + if ($values['location']['new']['citywrapper']['country_select'] != 'BE') { if (empty($values['location']['new']['citywrapper']['zip_code'])) { form_set_error('basic[zip_code]', t('A zip code is required for a custom location')); } - }*/ + } if (empty($values['location']['new']['citywrapper']['city'])) { form_set_error('city', t('A city is required for a custom location')); } - else { + if ($values['location']['new']['citywrapper']['country_select'] == 'BE') { $available_city = culturefeed_search_get_city_suggestions($values['location']['new']['citywrapper']['city'], TRUE); if (!isset($available_city[$values['location']['new']['citywrapper']['city']])) { - form_set_error('location', t('A valid location is required.')); + form_set_error('location', t('A valid city is required for a custom location')); } } $location = NULL; From b3b7d7a45d0340a718f7605b388f16c96fcf720d Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Tue, 10 Feb 2015 11:40:31 +0100 Subject: [PATCH 033/275] fix default address when country != BE --- culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index f62af5d9..4b4e6515 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -114,6 +114,9 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { if ($custom_location_country == 'BE') { $custom_location_city = $custom_location_zip . ' ' . $address->getCity(); } + else { + $custom_location_city = $address->getCity(); + } } } From a82d40cbd4e6c3b4f500dbb6d659987b82036aaf Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Tue, 10 Feb 2015 12:31:52 +0100 Subject: [PATCH 034/275] CF-393 fix translations --- .../includes/culturefeed_entry_ui.pages.inc | 4 +- .../translations/culturefeed_entry_ui.nl.po | 352 ++++++++++-------- .../culturefeed_entry_ui.views_default.inc | 68 ++-- 3 files changed, 233 insertions(+), 191 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 4b4e6515..3390bad1 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -1460,7 +1460,7 @@ function culturefeed_entry_ui_attach_language_elements(&$form, $i, $info = NULL) '#type' => 'select', '#title' => t('Language'), '#options' => array( - 0 => t(''), + 0 => '', 1 => t('Spoken'), 2 => t('Dubbed'), 3 => t('Subtitled'), @@ -1472,7 +1472,7 @@ function culturefeed_entry_ui_attach_language_elements(&$form, $i, $info = NULL) '#type' => 'select', '#title' => t('in'), '#options' => array( - 0 => t(''), + 0 => '', 1 => t('English'), //2 => t('Spanish'), 3 => t('Dutch'), diff --git a/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po b/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po index 1545bb80..824c6286 100644 --- a/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po +++ b/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po @@ -22,19 +22,18 @@ # js/culturefeed_entry_ui.js: n/a # views/culturefeed_entry_ui.views.inc: n/a # +#, fuzzy msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2015-01-22 16:05+0100\n" -"PO-Revision-Date: 2015-01-28 13:27+0100\n" +"POT-Creation-Date: 2015-02-10 12:25+0100\n" +"PO-Revision-Date: 2015-02-10 12:25+0100\n" "Last-Translator: NAME \n" "Language-Team: Dutch \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -"Language: nl\n" -"X-Generator: Poedit 1.7.4\n" #: culturefeed_entry_ui.module:18 msgid "Manage object tags" @@ -42,7 +41,9 @@ msgstr "Beheer object tags" #: culturefeed_entry_ui.module:19 msgid "Manage all the tags from the objects on culturefeed (events, actors, ...)." -msgstr "Beheer alle tags van objecten op culture feed (activiteiten, actoren ...)." +msgstr "" +"Beheer alle tags van objecten op culture feed (activiteiten, actoren " +"...)." #: culturefeed_entry_ui.module:22 msgid "Manage custom tags" @@ -60,7 +61,7 @@ msgstr "Events aanmaken" msgid "Create new events through the entity api." msgstr "Maak activiteiten aan via Entry API" -#: culturefeed_entry_ui.module:30 views/culturefeed_entry_ui.views_default.inc:171 +#: culturefeed_entry_ui.module:30 views/culturefeed_entry_ui.views_default.inc:131;171 msgid "Edit events" msgstr "Events aanpassen" @@ -76,7 +77,7 @@ msgstr "Verwijder events" msgid "Delete events through the entity api." msgstr "Verwijder activiteiten via Entry API" -#: culturefeed_entry_ui.module:135;63 includes/culturefeed_entry_ui.pages.inc:755;2508 views/handlers/views_handler_field_cdb_item_operations.inc:54 +#: culturefeed_entry_ui.module:135;63 includes/culturefeed_entry_ui.pages.inc:761;2535 views/handlers/views_handler_field_cdb_item_operations.inc:54 msgid "Tags" msgstr "Labels" @@ -94,7 +95,9 @@ msgstr "Voeg activiteit toe" #: culturefeed_entry_ui.module:401 msgid "Some disallowed html tags will be removed in the %field_name field. The allowed tags are %allowed_tags" -msgstr "Niet toegelaten html-tags zullen verwijderd worden in het veld %field_name. De toegelaten tags zijn %allowed_tags" +msgstr "" +"Niet toegelaten html-tags zullen verwijderd worden in het veld " +"%field_name. De toegelaten tags zijn %allowed_tags" #: culturefeed_entry_ui.module:71 msgid "New event" @@ -118,7 +121,9 @@ msgstr "" #: culturefeed_entry_ui.info:0 msgid "Multilingual forms to post, update and delete events to UiTDatabank Entry API" -msgstr "Meertalig invoerformulier om activiteiten aan te maken, aan te passen en verwijderen in UiTdatabank via Entry API" +msgstr "" +"Meertalig invoerformulier om activiteiten aan te maken, aan te passen " +"en verwijderen in UiTdatabank via Entry API" #: culturefeed_entry_ui.info:0 culturefeed_date_control/culturefeed_date_control.info:0 msgid "CultureFeed" @@ -136,7 +141,7 @@ msgstr "" msgid "Form element to manage dates in the Entry UI." msgstr "" -#: culturefeed_date_control/form/date_control.inc:28 includes/culturefeed_entry_ui.pages.inc:671 +#: culturefeed_date_control/form/date_control.inc:28 includes/culturefeed_entry_ui.pages.inc:677 msgid "Dates" msgstr "Datums" @@ -246,7 +251,9 @@ msgstr "Voorkeur taal" #: includes/culturefeed_entry_ui.admin.inc:23 msgid "Use the preferred language of the UiTID user, with the Drupal UI language as fallback" -msgstr "Gebruik de voorkeurstaal van de UiTiD gebruiker, met de Drupal UI taal als backup" +msgstr "" +"Gebruik de voorkeurstaal van de UiTiD gebruiker, met de Drupal UI taal " +"als backup" #: includes/culturefeed_entry_ui.admin.inc:30 msgid "Custom options on the /tags page" @@ -264,425 +271,458 @@ msgstr "" msgid "Tags pushed under the hood to Entry API. Use a new line for each tag." msgstr "" -#: includes/culturefeed_entry_ui.pages.inc:374;1220;1251;1282;1313 +#: includes/culturefeed_entry_ui.pages.inc:380;1234;1265;1296;1327 msgid "Event title" msgstr "Titel" -#: includes/culturefeed_entry_ui.pages.inc:422 +#: includes/culturefeed_entry_ui.pages.inc:428 msgid "Concerts" msgstr "Concerten" -#: includes/culturefeed_entry_ui.pages.inc:443 +#: includes/culturefeed_entry_ui.pages.inc:449 msgid "Dance" msgstr "Dansvoorstelling" -#: includes/culturefeed_entry_ui.pages.inc:464 +#: includes/culturefeed_entry_ui.pages.inc:470 msgid "Film" msgstr "Film" -#: includes/culturefeed_entry_ui.pages.inc:488 +#: includes/culturefeed_entry_ui.pages.inc:494 msgid "Theatre" msgstr "Theatervoorstelling" -#: includes/culturefeed_entry_ui.pages.inc:510 +#: includes/culturefeed_entry_ui.pages.inc:516 msgid "Sport" msgstr "Sport" -#: includes/culturefeed_entry_ui.pages.inc:545 +#: includes/culturefeed_entry_ui.pages.inc:551 msgid "Location" msgstr "Locatie" -#: includes/culturefeed_entry_ui.pages.inc:578 +#: includes/culturefeed_entry_ui.pages.inc:584 msgid "Location not found, add location" msgstr "Locatie niet gevonden, voeg locatie toe" -#: includes/culturefeed_entry_ui.pages.inc:599 +#: includes/culturefeed_entry_ui.pages.inc:605 msgid "Location Title" msgstr "Naam locatie" -#: includes/culturefeed_entry_ui.pages.inc:614 +#: includes/culturefeed_entry_ui.pages.inc:620 msgid "Country" msgstr "Land" -#: includes/culturefeed_entry_ui.pages.inc:627 +#: includes/culturefeed_entry_ui.pages.inc:633 msgid "ZIP Code" msgstr "Postcode" -#: includes/culturefeed_entry_ui.pages.inc:640 +#: includes/culturefeed_entry_ui.pages.inc:646 msgid "City" msgstr "Stad of gemeente" -#: includes/culturefeed_entry_ui.pages.inc:649 +#: includes/culturefeed_entry_ui.pages.inc:655 msgid "Street" msgstr "Straat" -#: includes/culturefeed_entry_ui.pages.inc:649 +#: includes/culturefeed_entry_ui.pages.inc:655 msgid "Street and House Number" msgstr "Straat en huisnummer" -#: includes/culturefeed_entry_ui.pages.inc:657 +#: includes/culturefeed_entry_ui.pages.inc:663 msgid "House Number" msgstr "Huisnummer" -#: includes/culturefeed_entry_ui.pages.inc:688 +#: includes/culturefeed_entry_ui.pages.inc:694 msgid "Extra info" msgstr "Extra info" -#: includes/culturefeed_entry_ui.pages.inc:696;704;722 +#: includes/culturefeed_entry_ui.pages.inc:702;710;728 msgid "Description" msgstr "Beschrijving" -#: includes/culturefeed_entry_ui.pages.inc:709;1226;1257;1288;1319 +#: includes/culturefeed_entry_ui.pages.inc:715;1240;1271;1302;1333 msgid "Short description" msgstr "Korte omschrijving" -#: includes/culturefeed_entry_ui.pages.inc:712 +#: includes/culturefeed_entry_ui.pages.inc:718 msgid "Maximum 400 characters" msgstr "Maximum 400 karakters" -#: includes/culturefeed_entry_ui.pages.inc:730 +#: includes/culturefeed_entry_ui.pages.inc:736 msgid "+ add long description" msgstr "+ voeg lange beschrijving toe" -#: includes/culturefeed_entry_ui.pages.inc:745;1233;1264;1295;1326 +#: includes/culturefeed_entry_ui.pages.inc:751;1247;1278;1309;1340 msgid "Long description" msgstr "Lange beschrijving" -#: includes/culturefeed_entry_ui.pages.inc:756 +#: includes/culturefeed_entry_ui.pages.inc:762 msgid "Add multiple tags seperated by a \";\"" msgstr "Voeg meerdere trefwoorden toe, gescheiden met een \";\"" -#: includes/culturefeed_entry_ui.pages.inc:766 +#: includes/culturefeed_entry_ui.pages.inc:772 msgid "Links" msgstr "Links" -#: includes/culturefeed_entry_ui.pages.inc:797 +#: includes/culturefeed_entry_ui.pages.inc:803 msgid "+ add another link" msgstr "+ voeg een link toe" -#: includes/culturefeed_entry_ui.pages.inc:814 +#: includes/culturefeed_entry_ui.pages.inc:820 msgid "Image" msgstr "Afbeelding" -#: includes/culturefeed_entry_ui.pages.inc:820 +#: includes/culturefeed_entry_ui.pages.inc:826 msgid "Image upload" msgstr "Afbeelding opladen" -#: includes/culturefeed_entry_ui.pages.inc:822 +#: includes/culturefeed_entry_ui.pages.inc:828 msgid "Allowed extensions: gif png jpg jpeg" msgstr "Ondersteunde bestandsformaten: gif, png, jpg, jpeg" -#: includes/culturefeed_entry_ui.pages.inc:847 +#: includes/culturefeed_entry_ui.pages.inc:853 +msgid "Copyright" +msgstr "" + +#: includes/culturefeed_entry_ui.pages.inc:854 +msgid "Name of the copyright owner of this image." +msgstr "" + +#: includes/culturefeed_entry_ui.pages.inc:861 msgid "I agree to the terms & conditions and I declare that I have the necessary rights or permissions to distribute the image." msgstr "" -"Ik ga akkoord met de algemene voorwaarden van UiTdatabank en verklaar dat ik over de nodige rechten beschik om de afbeelding " -"te verspreiden." +"Ik ga akkoord met de algemene " +"voorwaarden van UiTdatabank en verklaar dat ik over de nodige " +"rechten beschik om de afbeelding te verspreiden." -#: includes/culturefeed_entry_ui.pages.inc:854;859;891 +#: includes/culturefeed_entry_ui.pages.inc:868;873;905 msgid "Price" msgstr "Prijs" -#: includes/culturefeed_entry_ui.pages.inc:874 +#: includes/culturefeed_entry_ui.pages.inc:888 msgid "Free event" msgstr "Gratis activiteit" -#: includes/culturefeed_entry_ui.pages.inc:898 +#: includes/culturefeed_entry_ui.pages.inc:912 msgid "+ add conditions & discounts" msgstr "+ voeg voorwaarden en kortingen toe" -#: includes/culturefeed_entry_ui.pages.inc:925 +#: includes/culturefeed_entry_ui.pages.inc:939 msgid "Price conditions & discounts" msgstr "Prijsvoorwaarden & kortingen" -#: includes/culturefeed_entry_ui.pages.inc:954 +#: includes/culturefeed_entry_ui.pages.inc:968 msgid "Organizer" msgstr "Organisator" -#: includes/culturefeed_entry_ui.pages.inc:978 +#: includes/culturefeed_entry_ui.pages.inc:992 msgid "Organizer not found, add organizer" msgstr "Organisator niet gevonden, voeg organisator toe" -#: includes/culturefeed_entry_ui.pages.inc:995 +#: includes/culturefeed_entry_ui.pages.inc:1009 msgid "Name new organizer" msgstr "Naam nieuwe organisator" -#: includes/culturefeed_entry_ui.pages.inc:1002 +#: includes/culturefeed_entry_ui.pages.inc:1016 msgid "Age" msgstr "Leeftijd" -#: includes/culturefeed_entry_ui.pages.inc:1004 +#: includes/culturefeed_entry_ui.pages.inc:1018 msgid "For everyone" msgstr "Voor iedereen" -#: includes/culturefeed_entry_ui.pages.inc:1005 +#: includes/culturefeed_entry_ui.pages.inc:1019 msgid "For children (between 1 and 12 years)" msgstr "Voor kinderen (tussen 1 en 12 jaar)" -#: includes/culturefeed_entry_ui.pages.inc:1006 +#: includes/culturefeed_entry_ui.pages.inc:1020 msgid "For youth (between 12 and 18 years)" msgstr "Voor jongeren (tussen 12 en 18 jaar)" -#: includes/culturefeed_entry_ui.pages.inc:1007 +#: includes/culturefeed_entry_ui.pages.inc:1021 msgid "For adults (18+)" msgstr "Voor volwassenen (18+)" -#: includes/culturefeed_entry_ui.pages.inc:1013 +#: includes/culturefeed_entry_ui.pages.inc:1027 msgid "Suitable for ages from" msgstr "Geschikt voor leeftijden vanaf" -#: includes/culturefeed_entry_ui.pages.inc:1036 +#: includes/culturefeed_entry_ui.pages.inc:1050 msgid "Activities for children will get the 'Fly' label" msgstr "Activiteiten voor kinderen krijgen automatisch het 'Vlieg'-label" -#: includes/culturefeed_entry_ui.pages.inc:1047;1491 +#: includes/culturefeed_entry_ui.pages.inc:1061;1507 msgid "Contact" msgstr "Contact" -#: includes/culturefeed_entry_ui.pages.inc:1080 +#: includes/culturefeed_entry_ui.pages.inc:1094 msgid "+ add contact option" msgstr "+ voeg contactgegevens toe" -#: includes/culturefeed_entry_ui.pages.inc:1094 +#: includes/culturefeed_entry_ui.pages.inc:1108 msgid "Performers" msgstr "Uitvoerders" -#: includes/culturefeed_entry_ui.pages.inc:1129 +#: includes/culturefeed_entry_ui.pages.inc:1143 msgid "+ add another performer" msgstr "+ voeg nog een uitvoerder toe" -#: includes/culturefeed_entry_ui.pages.inc:1143;1445 +#: includes/culturefeed_entry_ui.pages.inc:1157;1461 msgid "Language" msgstr "Taal" -#: includes/culturefeed_entry_ui.pages.inc:1176 +#: includes/culturefeed_entry_ui.pages.inc:1190 msgid "+ add more language info" msgstr "+ voeg meer taalinformatie toe" -#: includes/culturefeed_entry_ui.pages.inc:1191 +#: includes/culturefeed_entry_ui.pages.inc:1205 msgid "Access" msgstr "Toegang" -#: includes/culturefeed_entry_ui.pages.inc:1197 +#: includes/culturefeed_entry_ui.pages.inc:1211 msgid "Open for everyone" msgstr "Voor iedereen toegankelijk" -#: includes/culturefeed_entry_ui.pages.inc:1197 +#: includes/culturefeed_entry_ui.pages.inc:1211 msgid "Only for members" msgstr "Enkel voor leden" -#: includes/culturefeed_entry_ui.pages.inc:1204 +#: includes/culturefeed_entry_ui.pages.inc:1218 msgid "Translations" msgstr "Vertalingen" -#: includes/culturefeed_entry_ui.pages.inc:1212;1462 +#: includes/culturefeed_entry_ui.pages.inc:1226;1478 msgid "Dutch" msgstr "Nederlands" -#: includes/culturefeed_entry_ui.pages.inc:1243;1460 +#: includes/culturefeed_entry_ui.pages.inc:1257;1476 msgid "English" msgstr "Engels" -#: includes/culturefeed_entry_ui.pages.inc:1274;1464 +#: includes/culturefeed_entry_ui.pages.inc:1288;1480 msgid "French" msgstr "Frans" -#: includes/culturefeed_entry_ui.pages.inc:1305;1463 +#: includes/culturefeed_entry_ui.pages.inc:1319;1479 msgid "German" msgstr "Duits" -#: includes/culturefeed_entry_ui.pages.inc:1334 +#: includes/culturefeed_entry_ui.pages.inc:1348 msgid "Publication date" msgstr "Publicatiedatum" -#: includes/culturefeed_entry_ui.pages.inc:1358 +#: includes/culturefeed_entry_ui.pages.inc:1372 msgid "Save" msgstr "Opslaan" -#: includes/culturefeed_entry_ui.pages.inc:1448 +#: includes/culturefeed_entry_ui.pages.inc:1464 msgid "Spoken" msgstr "Gesproken" -#: includes/culturefeed_entry_ui.pages.inc:1449 +#: includes/culturefeed_entry_ui.pages.inc:1465 msgid "Dubbed" msgstr "Gedubd" -#: includes/culturefeed_entry_ui.pages.inc:1450 +#: includes/culturefeed_entry_ui.pages.inc:1466 msgid "Subtitled" msgstr "Ondertiteld" -#: includes/culturefeed_entry_ui.pages.inc:1457 +#: includes/culturefeed_entry_ui.pages.inc:1473 msgid "in" msgstr "in" -#: includes/culturefeed_entry_ui.pages.inc:1500 +#: includes/culturefeed_entry_ui.pages.inc:1516 msgid "Input" msgstr "Invoer" -#: includes/culturefeed_entry_ui.pages.inc:1516 +#: includes/culturefeed_entry_ui.pages.inc:1532 msgid "Performer" msgstr "Uitvoerder" -#: includes/culturefeed_entry_ui.pages.inc:1524 +#: includes/culturefeed_entry_ui.pages.inc:1540 msgid "Role" msgstr "Rol" -#: includes/culturefeed_entry_ui.pages.inc:1539 +#: includes/culturefeed_entry_ui.pages.inc:1555 msgid "Link" msgstr "Link" -#: includes/culturefeed_entry_ui.pages.inc:1546 +#: includes/culturefeed_entry_ui.pages.inc:1562 msgid "for reservation" msgstr "voor reservatie" -#: includes/culturefeed_entry_ui.pages.inc:1562 +#: includes/culturefeed_entry_ui.pages.inc:1578 msgid "Please fill in correct age" msgstr "Geef de juiste leeftijd op" -#: includes/culturefeed_entry_ui.pages.inc:1579;1609 +#: includes/culturefeed_entry_ui.pages.inc:1595;1625 msgid "Please fill in correct date and time" msgstr "Geef de juiste datum en tijdstip op" -#: includes/culturefeed_entry_ui.pages.inc:1586 +#: includes/culturefeed_entry_ui.pages.inc:1602 msgid "Date field is invalid. The end date is earlier than the beginning date." msgstr "Ingevoerde datum niet correct: einddatum valt voor de begindatum" -#: includes/culturefeed_entry_ui.pages.inc:1616 +#: includes/culturefeed_entry_ui.pages.inc:1632 msgid "Date field is invalid. The end time is earlier than the beginning time." msgstr "Ingevoerde datum niet correct: einduur valt voor beginuur" -#: includes/culturefeed_entry_ui.pages.inc:1650;1657 +#: includes/culturefeed_entry_ui.pages.inc:1666;1673 msgid "Please fill in correct time." msgstr "Geef de juiste datum en tijdstip op" -#: includes/culturefeed_entry_ui.pages.inc:1672 +#: includes/culturefeed_entry_ui.pages.inc:1688 msgid "Please agree to the general conditions of UiTdatabank and declare that you have the necessary rights or permissions to distribute the image through UiTdatabank." -msgstr "Geef aan dat je akkoord gaat met de algemene voorwaarden van UiTdatabank en dat je over de nodige rechten of toestemmingen beschikt om de afbeelding te verspreiden via UiTdatabank." +msgstr "" +"Geef aan dat je akkoord gaat met de algemene voorwaarden van " +"UiTdatabank en dat je over de nodige rechten of toestemmingen beschikt " +"om de afbeelding te verspreiden via UiTdatabank." -#: includes/culturefeed_entry_ui.pages.inc:1677 +#: includes/culturefeed_entry_ui.pages.inc:1691 +msgid "Copyright field is required." +msgstr "" + +#: includes/culturefeed_entry_ui.pages.inc:1696 msgid "A category is required." msgstr "Een categorie is verplicht" -#: includes/culturefeed_entry_ui.pages.inc:1683 +#: includes/culturefeed_entry_ui.pages.inc:1702 msgid "A title is required for a custom location" msgstr "Een titel is verplicht voor een nieuwe locatie" -#: includes/culturefeed_entry_ui.pages.inc:1691 +#: includes/culturefeed_entry_ui.pages.inc:1706 +msgid "A zip code is required for a custom location" +msgstr "Een postcode is verplicht voor een nieuwe locatie" + +#: includes/culturefeed_entry_ui.pages.inc:1710 msgid "A city is required for a custom location" msgstr "Een stad is verplicht voor een nieuwe locatie" -#: includes/culturefeed_entry_ui.pages.inc:1698 +#: includes/culturefeed_entry_ui.pages.inc:1715 +msgid "A valid city is required for a custom location" +msgstr "" + +#: includes/culturefeed_entry_ui.pages.inc:1723 msgid "A location is required." msgstr "Een locatie is verplicht" -#: includes/culturefeed_entry_ui.pages.inc:1703;1707 +#: includes/culturefeed_entry_ui.pages.inc:1728;1732 msgid "We could not validate the location" msgstr "We kunnen de locatie niet bevestigen" -#: includes/culturefeed_entry_ui.pages.inc:1746 +#: includes/culturefeed_entry_ui.pages.inc:1771 msgid "Not a valid URL" msgstr "Geen geldige URL" -#: includes/culturefeed_entry_ui.pages.inc:1758;1762 +#: includes/culturefeed_entry_ui.pages.inc:1783;1787 msgid "We could not validate the organizer" msgstr "We kunnen de organisatie niet bevestigen" -#: includes/culturefeed_entry_ui.pages.inc:1778 +#: includes/culturefeed_entry_ui.pages.inc:1803 msgid "Not a valid email address" msgstr "Geen geldig emailadres" -#: includes/culturefeed_entry_ui.pages.inc:1797 +#: includes/culturefeed_entry_ui.pages.inc:1822 msgid "If you translate something, you should also translate the title." msgstr "Als je een vertaling toevoegt, moet je ook de titel vertalen." -#: includes/culturefeed_entry_ui.pages.inc:1935 +#: includes/culturefeed_entry_ui.pages.inc:1962 msgid "Order tickets" msgstr "Bestel tickets" -#: includes/culturefeed_entry_ui.pages.inc:2313 +#: includes/culturefeed_entry_ui.pages.inc:2340 msgid "An error occurred while saving the event" msgstr "Er is een fout opgetreden tijdens het opslaan van de activiteit" -#: includes/culturefeed_entry_ui.pages.inc:2414 +#: includes/culturefeed_entry_ui.pages.inc:2441 msgid "Saving the event" msgstr "gfh" -#: includes/culturefeed_entry_ui.pages.inc:2421 +#: includes/culturefeed_entry_ui.pages.inc:2448 msgid "Initializing." msgstr "Aan het initialiseren." -#: includes/culturefeed_entry_ui.pages.inc:2422 +#: includes/culturefeed_entry_ui.pages.inc:2449 msgid "Completed @current of @total." msgstr "@current van @total gereed." -#: includes/culturefeed_entry_ui.pages.inc:2440 +#: includes/culturefeed_entry_ui.pages.inc:2467 msgid "Are you sure you want to delete the event?" msgstr "Ben je zeker dat je de activiteit wil verwijderen?" -#: includes/culturefeed_entry_ui.pages.inc:2442 +#: includes/culturefeed_entry_ui.pages.inc:2469 msgid "This action cannot be undone" msgstr "Deze actie kan niet ongedaan gemaakt worden" -#: includes/culturefeed_entry_ui.pages.inc:2443 views/handlers/views_handler_field_cdb_item_operations.inc:31 +#: includes/culturefeed_entry_ui.pages.inc:2470 views/handlers/views_handler_field_cdb_item_operations.inc:31 msgid "Delete" msgstr "Verwijder" -#: includes/culturefeed_entry_ui.pages.inc:2444 +#: includes/culturefeed_entry_ui.pages.inc:2471 msgid "Cancel" msgstr "Annuleren" -#: includes/culturefeed_entry_ui.pages.inc:2456 +#: includes/culturefeed_entry_ui.pages.inc:2483 msgid "Event successfully deleted" msgstr "Activiteit werd verwijderd" -#: includes/culturefeed_entry_ui.pages.inc:2460 +#: includes/culturefeed_entry_ui.pages.inc:2487 msgid "An error occurred while deleting the event" msgstr "Er is een fout opgetreden tijdens het verwijderen van de activiteit" -#: includes/culturefeed_entry_ui.pages.inc:2501 +#: includes/culturefeed_entry_ui.pages.inc:2528 msgid "Custom tags" msgstr "" -#: includes/culturefeed_entry_ui.pages.inc:2510 +#: includes/culturefeed_entry_ui.pages.inc:2537 msgid "Seperate multiple tags by ;" msgstr "Scheid meerdere trefwoorden met ;" -#: includes/culturefeed_entry_ui.pages.inc:2515 views/culturefeed_entry_ui.views_default.inc:31;160 +#: includes/culturefeed_entry_ui.pages.inc:2542 msgid "Submit" msgstr "Voeg toe" -#: includes/culturefeed_entry_ui.pages.inc:2530 +#: includes/culturefeed_entry_ui.pages.inc:2557 msgid "Tag @tag is not permitted because it's already a custom tag." -msgstr "Trefwoord @tag is niet toegelaten aangezien het al een bestaande marker is." +msgstr "" +"Trefwoord @tag is niet toegelaten aangezien het al een bestaande " +"marker is." -#: includes/culturefeed_entry_ui.pages.inc:2577 +#: includes/culturefeed_entry_ui.pages.inc:2604 msgid "The tags were adjusted. However, it takes half an hour before these changes on all channels (including Uitinvlaanderen) will be. Available under the \"View\" tab" -msgstr "De labels werden aangepast. Het kan echter een half uur duren vooraleer deze wijzigingen op alle kanalen (waaronder UiTinVlaanderen) zichtbaar zijn." +msgstr "" +"De labels werden aangepast. Het kan echter een half uur duren " +"vooraleer deze wijzigingen op alle kanalen (waaronder UiTinVlaanderen) " +"zichtbaar zijn." -#: includes/culturefeed_entry_ui.pages.inc:2582 +#: includes/culturefeed_entry_ui.pages.inc:2609 msgid "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\"." -msgstr "Je hebt niet de juiste rechten om dit trefwoord toe te voegen. Als je hier vragen bij hebt, contacteer dan onze helpdesk via \"vragen@uitdatabank.be\"." +msgstr "" +"Je hebt niet de juiste rechten om dit trefwoord toe te voegen. Als je " +"hier vragen bij hebt, contacteer dan onze helpdesk via " +"\"vragen@uitdatabank.be\"." -#: includes/culturefeed_entry_ui.pages.inc:2585 +#: includes/culturefeed_entry_ui.pages.inc:2612 msgid "Error occured while saving the tags" msgstr "Er is een fout opgetreden tijdens het opslaan van de labels" -#: includes/culturefeed_entry_ui.pages.inc:2659 +#: includes/culturefeed_entry_ui.pages.inc:2686 msgid "The event %title has been created." msgstr "De activiteit %title werd aangemaakt." -#: includes/culturefeed_entry_ui.pages.inc:2660 +#: includes/culturefeed_entry_ui.pages.inc:2687 msgid "The event %title has been updated." msgstr "Het event %title werd aangepast." -#: includes/culturefeed_entry_ui.pages.inc:2301;2306 +#: includes/culturefeed_entry_ui.pages.inc:2328;2333 msgid "culturefeed_entry_ui" msgstr "" -#: includes/culturefeed_entry_ui.pages.inc:2301 +#: includes/culturefeed_entry_ui.pages.inc:2328 msgid "Event %eventid updated." msgstr "" -#: includes/culturefeed_entry_ui.pages.inc:2306 +#: includes/culturefeed_entry_ui.pages.inc:2333 msgid "Event %eventid created." msgstr "" @@ -706,16 +746,20 @@ msgstr "Maak activiteit aan" msgid "Link to create event" msgstr "Link om activiteit aan te maken" -#: views/culturefeed_entry_ui.views_default.inc:25 -msgid "More" -msgstr "Meer" +#: views/culturefeed_entry_ui.views_default.inc:25;159 +msgid "more" +msgstr "meer" + +#: views/culturefeed_entry_ui.views_default.inc:31;160 +msgid "Select" +msgstr "Selecteren" #: views/culturefeed_entry_ui.views_default.inc:32;161 msgid "Reset" msgstr "Opnieuw instellen" #: views/culturefeed_entry_ui.views_default.inc:33;162 -msgid "Sort on" +msgid "Sort" msgstr "Sorteer op" #: views/culturefeed_entry_ui.views_default.inc:34;163 @@ -726,70 +770,68 @@ msgstr "Oplopend" msgid "Descending" msgstr "Aflopend" -#: views/culturefeed_entry_ui.views_default.inc:157 -msgid "Master" -msgstr "" - -#: views/culturefeed_entry_ui.views_default.inc:158 -msgid "Events created by me" -msgstr "Mijn activiteiten" - -#: views/culturefeed_entry_ui.views_default.inc:159 -msgid "more" -msgstr "meer" - -#: views/culturefeed_entry_ui.views_default.inc:165 +#: views/culturefeed_entry_ui.views_default.inc:48;165 msgid "Notification that no results were found" msgstr "Melding dat er geen resultaten werden gevonden" -#: views/culturefeed_entry_ui.views_default.inc:166 +#: views/culturefeed_entry_ui.views_default.inc:50;166 msgid "Unable to find any events created by you." msgstr "Er werden geen activiteiten gevonden die door jou aangemaakt werden" -#: views/culturefeed_entry_ui.views_default.inc:167 -msgid "Last updated" -msgstr "Laatst bijgewerkt" - -#: views/culturefeed_entry_ui.views_default.inc:168 +#: views/culturefeed_entry_ui.views_default.inc:121;168 msgid "Created by current user" msgstr "" -#: views/culturefeed_entry_ui.views_default.inc:169 +#: views/culturefeed_entry_ui.views_default.inc:126;169 msgid "Block" msgstr "Blok" -#: views/culturefeed_entry_ui.views_default.inc:170 +#: views/culturefeed_entry_ui.views_default.inc:129;170 msgid "Page" msgstr "Pagina" -#: views/culturefeed_entry_ui.views_default.inc:172 -msgid "Items per page" +#: views/culturefeed_entry_ui.views_default.inc:138;172 +msgid "Items on page" msgstr "" -#: views/culturefeed_entry_ui.views_default.inc:173 +#: views/culturefeed_entry_ui.views_default.inc:139;173 msgid "- All -" msgstr "" -#: views/culturefeed_entry_ui.views_default.inc:174 +#: views/culturefeed_entry_ui.views_default.inc:140;174 msgid "Start" msgstr "" -#: views/culturefeed_entry_ui.views_default.inc:175 +#: views/culturefeed_entry_ui.views_default.inc:141;175 msgid "« first" msgstr "« eerste" -#: views/culturefeed_entry_ui.views_default.inc:176 +#: views/culturefeed_entry_ui.views_default.inc:142;176 msgid "‹ previous" msgstr "‹ vorige" -#: views/culturefeed_entry_ui.views_default.inc:177 +#: views/culturefeed_entry_ui.views_default.inc:143;177 msgid "next ›" msgstr "volgende ›" -#: views/culturefeed_entry_ui.views_default.inc:178 +#: views/culturefeed_entry_ui.views_default.inc:144;178 msgid "last »" msgstr "laatste »" +#: views/culturefeed_entry_ui.views_default.inc:157 +msgid "Master" +msgstr "" + +#: views/culturefeed_entry_ui.views_default.inc:158 +msgid "Events created by me" +msgstr "Mijn activiteiten" + +#: views/culturefeed_entry_ui.views_default.inc:167 +msgid "Last updated" +msgstr "Laatst bijgewerkt" + #: views/handlers/views_handler_field_cdb_item_operations.inc:47 msgid "No permission to edit event" msgstr "" + +
    Requested 0 API calls in 0 ms Queries exceeding 100 ms are highlighted.
    \ No newline at end of file diff --git a/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc b/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc index 22803df4..d17207e9 100644 --- a/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc +++ b/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc @@ -22,17 +22,17 @@ function culturefeed_entry_ui_views_default_views() { $handler = $view->new_display('default', 'Master', 'default'); $handler->display->display_options['title'] = 'Events created by me'; $handler->display->display_options['use_more_always'] = FALSE; - $handler->display->display_options['use_more_text'] = 'meer'; + $handler->display->display_options['use_more_text'] = t('more'); $handler->display->display_options['access']['type'] = 'perm'; $handler->display->display_options['access']['perm'] = 'create culturefeed events'; $handler->display->display_options['cache']['type'] = 'none'; $handler->display->display_options['query']['type'] = 'views_query'; $handler->display->display_options['exposed_form']['type'] = 'basic'; - $handler->display->display_options['exposed_form']['options']['submit_button'] = 'Toepassen'; - $handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Opnieuw instellen'; - $handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Sorteren op'; - $handler->display->display_options['exposed_form']['options']['sort_asc_label'] = 'Oplopend'; - $handler->display->display_options['exposed_form']['options']['sort_desc_label'] = 'Aflopend'; + $handler->display->display_options['exposed_form']['options']['submit_button'] = t('Select'); + $handler->display->display_options['exposed_form']['options']['reset_button_label'] = t('Reset'); + $handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = t('Sort'); + $handler->display->display_options['exposed_form']['options']['sort_asc_label'] = t('Ascending'); + $handler->display->display_options['exposed_form']['options']['sort_desc_label'] = t('Descending'); $handler->display->display_options['pager']['type'] = 'none'; $handler->display->display_options['style_plugin'] = 'default'; $handler->display->display_options['row_plugin'] = 'fields'; @@ -45,9 +45,9 @@ function culturefeed_entry_ui_views_default_views() { $handler->display->display_options['empty']['area']['id'] = 'area'; $handler->display->display_options['empty']['area']['table'] = 'views'; $handler->display->display_options['empty']['area']['field'] = 'area'; - $handler->display->display_options['empty']['area']['label'] = 'Notification that no results were found'; + $handler->display->display_options['empty']['area']['label'] = t('Notification that no results were found'); $handler->display->display_options['empty']['area']['empty'] = TRUE; - $handler->display->display_options['empty']['area']['content'] = 'Unable to find any events created by you.'; + $handler->display->display_options['empty']['area']['content'] = t('Unable to find any events created by you.'); $handler->display->display_options['empty']['area']['format'] = 'filtered_html'; /* Veld: Cdb items: Titel */ $handler->display->display_options['fields']['title']['id'] = 'title'; @@ -118,30 +118,30 @@ function culturefeed_entry_ui_views_default_views() { $handler->display->display_options['filters']['createdbycurrentuser']['field'] = 'createdbycurrentuser'; $handler->display->display_options['filters']['createdbycurrentuser']['exposed'] = TRUE; $handler->display->display_options['filters']['createdbycurrentuser']['expose']['operator_id'] = 'createdbycurrentuser_op'; - $handler->display->display_options['filters']['createdbycurrentuser']['expose']['label'] = 'Created by current user'; + $handler->display->display_options['filters']['createdbycurrentuser']['expose']['label'] = t('Created by current user'); $handler->display->display_options['filters']['createdbycurrentuser']['expose']['operator'] = 'createdbycurrentuser_op'; $handler->display->display_options['filters']['createdbycurrentuser']['expose']['identifier'] = 'createdbycurrentuser'; /* Display: Block */ - $handler = $view->new_display('block', 'Block', 'block'); + $handler = $view->new_display('block', t('Block'), 'block'); /* Display: Pagina */ - $handler = $view->new_display('page', 'Pagina', 'page_1'); + $handler = $view->new_display('page', t('Page'), 'page_1'); $handler->display->display_options['defaults']['title'] = FALSE; - $handler->display->display_options['title'] = 'Edit events'; + $handler->display->display_options['title'] = t('Edit events'); $handler->display->display_options['defaults']['pager'] = FALSE; $handler->display->display_options['pager']['type'] = 'full'; $handler->display->display_options['pager']['options']['items_per_page'] = '10'; $handler->display->display_options['pager']['options']['offset'] = '0'; $handler->display->display_options['pager']['options']['id'] = '0'; $handler->display->display_options['pager']['options']['quantity'] = '9'; - $handler->display->display_options['pager']['options']['expose']['items_per_page_label'] = 'Items per pagina'; - $handler->display->display_options['pager']['options']['expose']['items_per_page_options_all_label'] = '- Alle -'; - $handler->display->display_options['pager']['options']['expose']['offset_label'] = 'Startpunt'; - $handler->display->display_options['pager']['options']['tags']['first'] = '« eerste'; - $handler->display->display_options['pager']['options']['tags']['previous'] = '‹ vorige'; - $handler->display->display_options['pager']['options']['tags']['next'] = 'volgende ›'; - $handler->display->display_options['pager']['options']['tags']['last'] = 'laatste »'; + $handler->display->display_options['pager']['options']['expose']['items_per_page_label'] = t('Items on page'); + $handler->display->display_options['pager']['options']['expose']['items_per_page_options_all_label'] = t('- All -'); + $handler->display->display_options['pager']['options']['expose']['offset_label'] = t('Start'); + $handler->display->display_options['pager']['options']['tags']['first'] = t('« first'); + $handler->display->display_options['pager']['options']['tags']['previous'] = t('‹ previous'); + $handler->display->display_options['pager']['options']['tags']['next'] = t('next ›'); + $handler->display->display_options['pager']['options']['tags']['last'] = t('last »'); $handler->display->display_options['defaults']['filter_groups'] = FALSE; $handler->display->display_options['defaults']['filters'] = FALSE; /* Filtercriterium: Cdb items: Type */ @@ -156,26 +156,26 @@ function culturefeed_entry_ui_views_default_views() { $translatables['culturefeed_events_createdbycurrentuser'] = array( t('Master'), t('Events created by me'), - t('meer'), - t('Toepassen'), - t('Opnieuw instellen'), - t('Sorteren op'), - t('Oplopend'), - t('Aflopend'), + t('more'), + t('Select'), + t('Reset'), + t('Sort'), + t('Ascending'), + t('Descending'), t('Notification that no results were found'), t('Unable to find any events created by you.'), - t('Laatst bijgewerkt'), + t('Last updated'), t('Created by current user'), t('Block'), - t('Pagina'), + t('Page'), t('Edit events'), - t('Items per pagina'), - t('- Alle -'), - t('Startpunt'), - t('« eerste'), - t('‹ vorige'), - t('volgende ›'), - t('laatste »'), + t('Items on page'), + t('- All -'), + t('Start'), + t('« first'), + t('‹ previous'), + t('next ›'), + t('last »'), ); $views[$view->name] = $view; From 894ebbb4c1db61a3171e7f3d2850e1d779c4e6a4 Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 12 Feb 2015 13:59:37 +0100 Subject: [PATCH 035/275] MSS-119 punt 8 zip markup --- culturefeed_entry_ui/js/bootstrap_autocomplete_override.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js index 4e1b66b8..1d1effe5 100644 --- a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js +++ b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js @@ -36,7 +36,7 @@ jQuery(function($) { .mousedown(function () { ac.select(this); }) .mouseover(function () { ac.highlight(this); }) .mouseout(function () { ac.unhighlight(this); }) - .data('autocompleteTitle', value) + .data('autocompleteTitle', matches[key].title) .data('autocompleteValue', matches[key].key) .appendTo(ul); } From ff3a759dbfa886e47becffb0d05c4b83e242d5a4 Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 12 Feb 2015 14:27:31 +0100 Subject: [PATCH 036/275] MSS-119 punt 7 better error message for custom city --- 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 ee8ff712..d7dd724e 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -1709,7 +1709,7 @@ function culturefeed_entry_ui_event_save_validate($form, &$form_state) { else { $available_city = culturefeed_search_get_city_suggestions($values['location']['new']['citywrapper']['city'], TRUE); if (!isset($available_city[$values['location']['new']['citywrapper']['city']])) { - form_set_error('location', t('A valid location is required.')); + form_set_error('location][new][citywrapper][city', t('Please select a city from the list.')); } } $location = NULL; From 06df9025c52a9355775e5fe8733914089fff6fb3 Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Fri, 13 Feb 2015 11:29:05 +0100 Subject: [PATCH 037/275] fix issues for stan --- .../includes/culturefeed_entry_ui.pages.inc | 11 ++-- .../translations/culturefeed_entry_ui.nl.po | 60 ++++++------------- 2 files changed, 26 insertions(+), 45 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index a346a561..6b664d5b 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -1489,7 +1489,7 @@ function culturefeed_entry_ui_attach_language_elements(&$form, $i, $info = NULL) */ function culturefeed_entry_ui_attach_contacts_elements(&$form, $i, $info = NULL) { - $options = array(0 => 'Phone', 1 => 'Email'); + $options = array(0 => t('Phone'), 1 => t('E-mail')); $contact_type = 0; if ($info[0] == 'phone') { @@ -1699,15 +1699,18 @@ function culturefeed_entry_ui_event_save_validate($form, &$form_state) { // Validate location if (isset($form_state['#location_needed']) && $form_state['#location_needed']) { if (empty($values['location']['new']['location_title'])) { - form_set_error('location_title', t('A title is required for a custom location')); + form_set_error('location][new][location_title', t('A title is required for a custom location')); } if ($values['location']['new']['citywrapper']['country_select'] != 'BE') { if (empty($values['location']['new']['citywrapper']['zip_code'])) { - form_set_error('basic[zip_code]', t('A zip code is required for a custom location')); + form_set_error('location][new][citywrapper][zip_code', t('A zip code is required for a custom location')); + } + if (strlen($values['location']['new']['citywrapper']['zip_code']) < 5 || strlen($values['location']['new']['citywrapper']['zip_code']) > 15) { + form_set_error('location][new][citywrapper][zip_code', t('A zip code has minimum 4 characters')); } } if (empty($values['location']['new']['citywrapper']['city'])) { - form_set_error('city', t('A city is required for a custom location')); + form_set_error('location][new][citywrapper][city', t('A city is required for a custom location')); } if ($values['location']['new']['citywrapper']['country_select'] == 'BE') { $available_city = culturefeed_search_get_city_suggestions($values['location']['new']['citywrapper']['city'], TRUE); diff --git a/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po b/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po index 824c6286..4b9143da 100644 --- a/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po +++ b/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po @@ -22,18 +22,19 @@ # js/culturefeed_entry_ui.js: n/a # views/culturefeed_entry_ui.views.inc: n/a # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "POT-Creation-Date: 2015-02-10 12:25+0100\n" -"PO-Revision-Date: 2015-02-10 12:25+0100\n" +"PO-Revision-Date: 2015-02-10 15:54+0100\n" "Last-Translator: NAME \n" "Language-Team: Dutch \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" +"Language: nl\n" +"X-Generator: Poedit 1.7.4\n" #: culturefeed_entry_ui.module:18 msgid "Manage object tags" @@ -41,9 +42,7 @@ msgstr "Beheer object tags" #: culturefeed_entry_ui.module:19 msgid "Manage all the tags from the objects on culturefeed (events, actors, ...)." -msgstr "" -"Beheer alle tags van objecten op culture feed (activiteiten, actoren " -"...)." +msgstr "Beheer alle tags van objecten op culture feed (activiteiten, actoren ...)." #: culturefeed_entry_ui.module:22 msgid "Manage custom tags" @@ -95,9 +94,7 @@ msgstr "Voeg activiteit toe" #: culturefeed_entry_ui.module:401 msgid "Some disallowed html tags will be removed in the %field_name field. The allowed tags are %allowed_tags" -msgstr "" -"Niet toegelaten html-tags zullen verwijderd worden in het veld " -"%field_name. De toegelaten tags zijn %allowed_tags" +msgstr "Niet toegelaten html-tags zullen verwijderd worden in het veld %field_name. De toegelaten tags zijn %allowed_tags" #: culturefeed_entry_ui.module:71 msgid "New event" @@ -121,9 +118,7 @@ msgstr "" #: culturefeed_entry_ui.info:0 msgid "Multilingual forms to post, update and delete events to UiTDatabank Entry API" -msgstr "" -"Meertalig invoerformulier om activiteiten aan te maken, aan te passen " -"en verwijderen in UiTdatabank via Entry API" +msgstr "Meertalig invoerformulier om activiteiten aan te maken, aan te passen en verwijderen in UiTdatabank via Entry API" #: culturefeed_entry_ui.info:0 culturefeed_date_control/culturefeed_date_control.info:0 msgid "CultureFeed" @@ -251,9 +246,7 @@ msgstr "Voorkeur taal" #: includes/culturefeed_entry_ui.admin.inc:23 msgid "Use the preferred language of the UiTID user, with the Drupal UI language as fallback" -msgstr "" -"Gebruik de voorkeurstaal van de UiTiD gebruiker, met de Drupal UI taal " -"als backup" +msgstr "Gebruik de voorkeurstaal van de UiTiD gebruiker, met de Drupal UI taal als backup" #: includes/culturefeed_entry_ui.admin.inc:30 msgid "Custom options on the /tags page" @@ -381,19 +374,17 @@ msgstr "Ondersteunde bestandsformaten: gif, png, jpg, jpeg" #: includes/culturefeed_entry_ui.pages.inc:853 msgid "Copyright" -msgstr "" +msgstr "Copyright" #: includes/culturefeed_entry_ui.pages.inc:854 msgid "Name of the copyright owner of this image." -msgstr "" +msgstr "Naam van de copyright eigenaar van deze afbeelding" #: includes/culturefeed_entry_ui.pages.inc:861 msgid "I agree to the terms & conditions and I declare that I have the necessary rights or permissions to distribute the image." msgstr "" -"Ik ga akkoord met de algemene " -"voorwaarden van UiTdatabank en verklaar dat ik over de nodige " -"rechten beschik om de afbeelding te verspreiden." +"Ik ga akkoord met de algemene voorwaarden van UiTdatabank en verklaar dat ik over de nodige rechten beschik om de afbeelding " +"te verspreiden." #: includes/culturefeed_entry_ui.pages.inc:868;873;905 msgid "Price" @@ -573,14 +564,11 @@ msgstr "Geef de juiste datum en tijdstip op" #: includes/culturefeed_entry_ui.pages.inc:1688 msgid "Please agree to the general conditions of UiTdatabank and declare that you have the necessary rights or permissions to distribute the image through UiTdatabank." -msgstr "" -"Geef aan dat je akkoord gaat met de algemene voorwaarden van " -"UiTdatabank en dat je over de nodige rechten of toestemmingen beschikt " -"om de afbeelding te verspreiden via UiTdatabank." +msgstr "Geef aan dat je akkoord gaat met de algemene voorwaarden van UiTdatabank en dat je over de nodige rechten of toestemmingen beschikt om de afbeelding te verspreiden via UiTdatabank." #: includes/culturefeed_entry_ui.pages.inc:1691 msgid "Copyright field is required." -msgstr "" +msgstr "Het veld 'copyright' is verplicht." #: includes/culturefeed_entry_ui.pages.inc:1696 msgid "A category is required." @@ -600,7 +588,7 @@ msgstr "Een stad is verplicht voor een nieuwe locatie" #: includes/culturefeed_entry_ui.pages.inc:1715 msgid "A valid city is required for a custom location" -msgstr "" +msgstr "Een geldige stad/gemeente is verplicht voor een nieuwe locatie" #: includes/culturefeed_entry_ui.pages.inc:1723 msgid "A location is required." @@ -684,23 +672,15 @@ msgstr "Voeg toe" #: includes/culturefeed_entry_ui.pages.inc:2557 msgid "Tag @tag is not permitted because it's already a custom tag." -msgstr "" -"Trefwoord @tag is niet toegelaten aangezien het al een bestaande " -"marker is." +msgstr "Trefwoord @tag is niet toegelaten aangezien het al een bestaande marker is." #: includes/culturefeed_entry_ui.pages.inc:2604 msgid "The tags were adjusted. However, it takes half an hour before these changes on all channels (including Uitinvlaanderen) will be. Available under the \"View\" tab" -msgstr "" -"De labels werden aangepast. Het kan echter een half uur duren " -"vooraleer deze wijzigingen op alle kanalen (waaronder UiTinVlaanderen) " -"zichtbaar zijn." +msgstr "De labels werden aangepast. Het kan echter een half uur duren vooraleer deze wijzigingen op alle kanalen (waaronder UiTinVlaanderen) zichtbaar zijn." #: includes/culturefeed_entry_ui.pages.inc:2609 msgid "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\"." -msgstr "" -"Je hebt niet de juiste rechten om dit trefwoord toe te voegen. Als je " -"hier vragen bij hebt, contacteer dan onze helpdesk via " -"\"vragen@uitdatabank.be\"." +msgstr "Je hebt niet de juiste rechten om dit trefwoord toe te voegen. Als je hier vragen bij hebt, contacteer dan onze helpdesk via \"vragen@uitdatabank.be\"." #: includes/culturefeed_entry_ui.pages.inc:2612 msgid "Error occured while saving the tags" @@ -800,7 +780,7 @@ msgstr "" #: views/culturefeed_entry_ui.views_default.inc:140;174 msgid "Start" -msgstr "" +msgstr "Start" #: views/culturefeed_entry_ui.views_default.inc:141;175 msgid "« first" @@ -832,6 +812,4 @@ msgstr "Laatst bijgewerkt" #: views/handlers/views_handler_field_cdb_item_operations.inc:47 msgid "No permission to edit event" -msgstr "" - -
    Requested 0 API calls in 0 ms Queries exceeding 100 ms are highlighted.
    \ No newline at end of file +msgstr "Geen toelating om event aan te passen" From e4370c3b4ff782ca0da193db9fa4b79848942aac Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Fri, 13 Feb 2015 11:34:32 +0100 Subject: [PATCH 038/275] fix gfh on save event --- culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po b/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po index 4b9143da..94583cf9 100644 --- a/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po +++ b/culturefeed_entry_ui/translations/culturefeed_entry_ui.nl.po @@ -624,7 +624,7 @@ msgstr "Er is een fout opgetreden tijdens het opslaan van de activiteit" #: includes/culturefeed_entry_ui.pages.inc:2441 msgid "Saving the event" -msgstr "gfh" +msgstr "Evenement aan het bewaren" #: includes/culturefeed_entry_ui.pages.inc:2448 msgid "Initializing." From e584298d6505a53dd5d169f65849a9cbfbb61c65 Mon Sep 17 00:00:00 2001 From: HnLn Date: Fri, 13 Feb 2015 16:41:45 +0100 Subject: [PATCH 039/275] MSS-119 punt 5 --- culturefeed_entry_ui/js/culturefeed_entry_ui.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/culturefeed_entry_ui/js/culturefeed_entry_ui.js b/culturefeed_entry_ui/js/culturefeed_entry_ui.js index 8dd5050e..855fa857 100644 --- a/culturefeed_entry_ui/js/culturefeed_entry_ui.js +++ b/culturefeed_entry_ui/js/culturefeed_entry_ui.js @@ -74,9 +74,9 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; * Fire the autocomplete on paste. */ Drupal.behaviors.autocomplete_paste = { - attach: function (context, settings) { - $('.form-autocomplete input').bind("paste", function () { - $(this).populatePopup(); + attach: function () { + $('input.form-autocomplete, .form-autocomplete input.form-text').bind("input propertychange", function (event) { + $(this).trigger('keyup'); }); } } From 33b6dc0f56b73ebdae9acf09ab5e60a4257c2d6a Mon Sep 17 00:00:00 2001 From: HnLn Date: Mon, 16 Feb 2015 12:27:28 +0100 Subject: [PATCH 040/275] MSS-119 de nice to have's --- culturefeed_entry_ui/culturefeed_entry_ui.module | 7 +++++++ .../includes/culturefeed_entry_ui.pages.inc | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/culturefeed_entry_ui/culturefeed_entry_ui.module b/culturefeed_entry_ui/culturefeed_entry_ui.module index 03d929b8..81576f01 100644 --- a/culturefeed_entry_ui/culturefeed_entry_ui.module +++ b/culturefeed_entry_ui/culturefeed_entry_ui.module @@ -237,10 +237,17 @@ function culturefeed_entry_ui_add_more_submit($form, &$form_state) { case 'location_add_more': $form_state['#location_needed'] = TRUE; + if (isset($form_state['values']['location']['actor']['location_actor_label']) && $form_state['values']['location']['actor']['location_actor_label']) { + $form_state['#location_actor_label'] = $form_state['values']['location']['actor']['location_actor_label']; + } + break; case 'actor_add_more': $form_state['#actor_needed'] = TRUE; + if (isset($form_state['input']['organiser']['actor']['organiser_actor_label']) && $form_state['input']['organiser']['actor']['organiser_actor_label']) { + $form_state['#actor_label'] = $form_state['input']['organiser']['actor']['organiser_actor_label']; + } break; case 'performers_add_more': diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index d7dd724e..63711472 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -597,10 +597,14 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { $country = isset($form_state['values']['location']['new']['citywrapper']['country_select']) && $form_state['values']['location']['new']['citywrapper']['country_select'] ? $form_state['values']['location']['new']['citywrapper']['country_select'] : ($custom_location_country ? $custom_location_country : 'BE'); + $default_location_title = $custom_location_title ? $custom_location_title : ''; + if (isset($form_state['#location_actor_label'])) { + $default_location_title = $form_state['#location_actor_label']; + } $form['basic']['location']['new']['location_title'] = array( '#type' => 'textfield', '#title' => t('Location Title'), - '#default_value' => $custom_location_title ? $custom_location_title : '', + '#default_value' => $default_location_title, '#required' => FALSE, '#size' => 80, ); @@ -1001,9 +1005,11 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { ); if (isset($form_state['#actor_needed'])) { + $default_actor = isset($form_state['#actor_label']) ? $form_state['#actor_label'] : ''; $form['extra']['organiser']['new_actor'] = array( '#type' => 'textfield', '#title' => t('Name new organizer'), + '#default_value' => $default_actor, ); } From 327d4333549045405c1165a6e0dc4fe515523a4c Mon Sep 17 00:00:00 2001 From: Stijn Swaanen Date: Thu, 19 Feb 2015 10:55:57 +0100 Subject: [PATCH 041/275] UPS-1362 put advantages back on event detail page --- .../includes/event_details_advantages.inc | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/culturefeed_uitpas/includes/event_details_advantages.inc b/culturefeed_uitpas/includes/event_details_advantages.inc index a7e78d38..a3e3a1dc 100644 --- a/culturefeed_uitpas/includes/event_details_advantages.inc +++ b/culturefeed_uitpas/includes/event_details_advantages.inc @@ -63,17 +63,24 @@ function culturefeed_uitpas_event_details_advantages_get() { $query->unexpired = TRUE; $result = $cf->uitpas()->getPromotionPoints($query); - if ($result->total && $event->locationId) { + if ($result->total) { - $item_list['items'][] = array( - 'data' => l(t('Show advantages at') . ' ' . $event->locationName , 'agenda/a/' . culturefeed_search_slug($event->locationName) . '/' . $event->locationId), - 'class' => array('uitpas_has_promotion'), - ); + foreach ($result->objects as $object) { + $item_list['items'][] = array( + 'data' => $object->title, + 'class' => array('uitpas_has_promotion'), + ); + } } - + + if ($event->locationId) { + $item_list['items'][] = array( + 'data' => l(t('Show advantages at') . ' ' . $event->locationName , 'agenda/a/' . culturefeed_search_slug($event->locationName) . '/' . $event->locationId), + 'class' => array('uitpas_has_promotion'), + ); + } else { - $item_list['items'][] = array( 'data' => l(t('Show advantages at') . ' ' . $event->organiserName , 'agenda/a/' . culturefeed_search_slug($event->organiserName) . '/' . $event->organiserId), 'class' => array('uitpas_has_promotion'), From 1c908a9346e1974d7e9ed2ddc1472cf9a4d85e84 Mon Sep 17 00:00:00 2001 From: Stijn Swaanen Date: Thu, 19 Feb 2015 15:13:42 +0100 Subject: [PATCH 042/275] UPS-1603 fix link of pager on my promotions --- culturefeed_uitpas/includes/profile_promotions.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/culturefeed_uitpas/includes/profile_promotions.inc b/culturefeed_uitpas/includes/profile_promotions.inc index 5515829a..0666cbc2 100644 --- a/culturefeed_uitpas/includes/profile_promotions.inc +++ b/culturefeed_uitpas/includes/profile_promotions.inc @@ -64,7 +64,7 @@ function culturefeed_uitpas_profile_promotions_get($filter = NULL) { } // Solution csdco on from https://www.drupal.org/node/1049354 - $_GET['q'] = 'promotions'; + $_GET['q'] = 'culturefeed/profile/uitpas/promotions'; return array( array( From fe240e8166009e3d6b278e5ae6ea2421adbc13f7 Mon Sep 17 00:00:00 2001 From: Stijn Swaanen Date: Thu, 19 Feb 2015 15:56:33 +0100 Subject: [PATCH 043/275] UPS-1604 all available card systems in filter form on my promotions --- culturefeed_uitpas/includes/profile_promotions.inc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/culturefeed_uitpas/includes/profile_promotions.inc b/culturefeed_uitpas/includes/profile_promotions.inc index 0666cbc2..30bc0705 100644 --- a/culturefeed_uitpas/includes/profile_promotions.inc +++ b/culturefeed_uitpas/includes/profile_promotions.inc @@ -127,14 +127,13 @@ function culturefeed_uitpas_profile_promotions_filter_sort($form, $form_state) { '#markup' => '
  • ' . t('Welcome Advantages') . '
  • ', ); - $uitpas_user = culturefeed_uitpas_get_uitpas_user(); - - $card_systems = $uitpas_user->passholder->cardSystemSpecific; + $cf = DrupalCultureFeed::getConsumerInstance(); + $card_systems = $cf->uitpas()->getCardSystems(); $options = array(); - foreach ($card_systems as $system) { - $options[$system->cardSystem->id] = $system->cardSystem->name; - } + foreach ($card_systems as $system) { + $options[$system->id] = $system->name; + } $id = drupal_html_id('profile-promotions-filter-sort'); $form['profile_promotions']['#prefix'] = '
    '; From 6d1845f6c06056fd1717fa25474451bff69a5d75 Mon Sep 17 00:00:00 2001 From: Stijn Swaanen Date: Tue, 24 Feb 2015 08:32:46 +0100 Subject: [PATCH 044/275] UPS-1362 put event-details-advantages in a block tpl + links --- culturefeed_uitpas/culturefeed_uitpas.blocks.inc | 2 +- culturefeed_uitpas/culturefeed_uitpas.theme.inc | 8 ++++++++ culturefeed_uitpas/includes/event_details_advantages.inc | 7 +++++-- .../culturefeed-uitpas-event-details-advantages.tpl.php | 6 ++++++ 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 culturefeed_uitpas/theme/culturefeed-uitpas-event-details-advantages.tpl.php diff --git a/culturefeed_uitpas/culturefeed_uitpas.blocks.inc b/culturefeed_uitpas/culturefeed_uitpas.blocks.inc index fa54ac1a..c0c00cf6 100644 --- a/culturefeed_uitpas/culturefeed_uitpas.blocks.inc +++ b/culturefeed_uitpas/culturefeed_uitpas.blocks.inc @@ -113,11 +113,11 @@ function culturefeed_uitpas_block_view($delta = '') { case 'uitpas_event_details_advantages': module_load_include('inc', 'culturefeed_uitpas', 'includes/event_details_advantages'); $content = culturefeed_uitpas_event_details_advantages_get(); + if ($content) { $block['subject'] = t("UiTPAS Advantages"); $block['content'] = $content; - } break; diff --git a/culturefeed_uitpas/culturefeed_uitpas.theme.inc b/culturefeed_uitpas/culturefeed_uitpas.theme.inc index 0e382a50..ad32d790 100644 --- a/culturefeed_uitpas/culturefeed_uitpas.theme.inc +++ b/culturefeed_uitpas/culturefeed_uitpas.theme.inc @@ -111,6 +111,14 @@ function culturefeed_uitpas_theme() { 'file' => 'theme.inc', 'template' => 'culturefeed-uitpas-profile-summary', ), + 'culturefeed_uitpas_event_details_advantages' => array( + 'variables' => array( + 'items' => array(), + ), + 'path' => drupal_get_path('module', 'culturefeed_uitpas') . '/theme', + 'file' => 'theme.inc', + 'template' => 'culturefeed-uitpas-event-details-advantages', + ), 'culturefeed_uitpas_promotion' => array( 'variables' => array('promotion' => NULL), 'path' => drupal_get_path('module', 'culturefeed_uitpas') . '/theme', diff --git a/culturefeed_uitpas/includes/event_details_advantages.inc b/culturefeed_uitpas/includes/event_details_advantages.inc index a3e3a1dc..542ecfba 100644 --- a/culturefeed_uitpas/includes/event_details_advantages.inc +++ b/culturefeed_uitpas/includes/event_details_advantages.inc @@ -67,7 +67,7 @@ function culturefeed_uitpas_event_details_advantages_get() { foreach ($result->objects as $object) { $item_list['items'][] = array( - 'data' => $object->title, + 'data' => l($object->title , 'promotion/' . culturefeed_search_slug($object->title) . '/' . $object->id), 'class' => array('uitpas_has_promotion'), ); } @@ -93,7 +93,10 @@ function culturefeed_uitpas_event_details_advantages_get() { } if (count($item_list['items'])) { - return theme('item_list', $item_list); + return array( + '#theme' => 'culturefeed_uitpas_event_details_advantages', + '#items' => $item_list['items'], + ); } } diff --git a/culturefeed_uitpas/theme/culturefeed-uitpas-event-details-advantages.tpl.php b/culturefeed_uitpas/theme/culturefeed-uitpas-event-details-advantages.tpl.php new file mode 100644 index 00000000..8b0d3a0e --- /dev/null +++ b/culturefeed_uitpas/theme/culturefeed-uitpas-event-details-advantages.tpl.php @@ -0,0 +1,6 @@ +
      + + +
    • + +
    \ No newline at end of file From f720485fd2cd030fd0b81b5785bd5488959a7e36 Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Tue, 24 Feb 2015 11:07:42 +0100 Subject: [PATCH 045/275] button to footer in culturefeed_entry_ui view --- .../views/culturefeed_entry_ui.views_default.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc b/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc index d17207e9..546044fb 100644 --- a/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc +++ b/culturefeed_entry_ui/views/culturefeed_entry_ui.views_default.inc @@ -37,10 +37,10 @@ function culturefeed_entry_ui_views_default_views() { $handler->display->display_options['style_plugin'] = 'default'; $handler->display->display_options['row_plugin'] = 'fields'; /* Kop: Cdb items: Maak activiteit aan */ - $handler->display->display_options['header']['create']['id'] = 'create'; - $handler->display->display_options['header']['create']['table'] = 'cdb_items'; - $handler->display->display_options['header']['create']['field'] = 'create'; - $handler->display->display_options['header']['create']['empty'] = TRUE; + $handler->display->display_options['footer']['create']['id'] = 'create'; + $handler->display->display_options['footer']['create']['table'] = 'cdb_items'; + $handler->display->display_options['footer']['create']['field'] = 'create'; + $handler->display->display_options['footer']['create']['empty'] = TRUE; /* Gedrag bij ontbreken van resultaten: Algemeen: Tekstveld */ $handler->display->display_options['empty']['area']['id'] = 'area'; $handler->display->display_options['empty']['area']['table'] = 'views'; From 1a179d82261a4c4ea68634475299f191dadd9291 Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Tue, 24 Feb 2015 13:18:47 +0100 Subject: [PATCH 046/275] PWK-233 fix edit on detail and image on edit --- culturefeed_entry_ui/culturefeed_entry_ui.module | 3 ++- culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/culturefeed_entry_ui/culturefeed_entry_ui.module b/culturefeed_entry_ui/culturefeed_entry_ui.module index 03d929b8..91680f66 100644 --- a/culturefeed_entry_ui/culturefeed_entry_ui.module +++ b/culturefeed_entry_ui/culturefeed_entry_ui.module @@ -140,9 +140,10 @@ function culturefeed_entry_ui_menu_local_tasks_alter(&$data, $router_item, $root } $culturefeed_user = DrupalCultureFeed::getLoggedInUser(); + $ubd_permission = Drupalculturefeed_EntryApi::checkPermission($culturefeed_user->id, $culturefeed_user->mbox, array('ids' => $event->getId())); // Add tab for editing the event. - if (user_access('edit culturefeed events') && ($event->getEntity()->getCreatedBy() == $culturefeed_user->mbox)) { + if (user_access('edit culturefeed events') && ($event->getEntity()->getCreatedBy() == $culturefeed_user->mbox || $ubd_permission[$event->getId()] == 'true')) { $link = array( 'href' => $path . '/edit', diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 6b664d5b..f7aa8738 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -260,7 +260,8 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { } try { - $default_image = system_retrieve_file('http:' . $main_image->getHLink(), 'public://uploads/' . $main_image->getFileName(), TRUE); + $default_image = system_retrieve_file('http:' . $main_image->getHLink(), 'public://uploads/', TRUE); + if ($default_image) { file_usage_add($default_image, 'culturefeed_entry_ui', 'event', $default_image->fid); $default_image_hlink = $main_image->getHLink(); From 23b1f7d115d1930302d9b738ab21bdb5e725abae Mon Sep 17 00:00:00 2001 From: HnLn Date: Tue, 24 Feb 2015 15:12:15 +0100 Subject: [PATCH 047/275] MSS-119 punt 4: location control --- .../culturefeed_entry_ui.info | 1 + .../culturefeed_entry_ui.module | 32 +- .../culturefeed_location_control.info | 5 + .../culturefeed_location_control.module | 113 ++++++ .../form/asset.inc | 163 +++++++++ .../form/custom.inc | 223 ++++++++++++ .../form/location_control.inc | 198 ++++++++++ .../includes/culturefeed_entry_ui.pages.inc | 296 +-------------- .../form/culturefeed_entry_ui.location.inc | 246 +++++++++++++ .../js/bootstrap_autocomplete_override.js | 252 +++++++------ .../js/culturefeed_entry_ui.js | 343 ++++++++++-------- 11 files changed, 1288 insertions(+), 584 deletions(-) create mode 100644 culturefeed_entry_ui/culturefeed_location_control/culturefeed_location_control.info create mode 100644 culturefeed_entry_ui/culturefeed_location_control/culturefeed_location_control.module create mode 100644 culturefeed_entry_ui/culturefeed_location_control/form/asset.inc create mode 100644 culturefeed_entry_ui/culturefeed_location_control/form/custom.inc create mode 100644 culturefeed_entry_ui/culturefeed_location_control/form/location_control.inc create mode 100644 culturefeed_entry_ui/includes/form/culturefeed_entry_ui.location.inc diff --git a/culturefeed_entry_ui/culturefeed_entry_ui.info b/culturefeed_entry_ui/culturefeed_entry_ui.info index f11ff2a3..99ca5414 100644 --- a/culturefeed_entry_ui/culturefeed_entry_ui.info +++ b/culturefeed_entry_ui/culturefeed_entry_ui.info @@ -7,6 +7,7 @@ dependencies[] = culturefeed_search dependencies[] = culturefeed_search_views dependencies[] = culturefeed dependencies[] = culturefeed_date_control +dependencies[] = culturefeed_location_control dependencies[] = file dependencies[] = date dependencies[] = date_api diff --git a/culturefeed_entry_ui/culturefeed_entry_ui.module b/culturefeed_entry_ui/culturefeed_entry_ui.module index 81576f01..7b3d0987 100644 --- a/culturefeed_entry_ui/culturefeed_entry_ui.module +++ b/culturefeed_entry_ui/culturefeed_entry_ui.module @@ -235,14 +235,6 @@ function culturefeed_entry_ui_add_more_submit($form, &$form_state) { $form_state['#price_needed'] = TRUE; break; - case 'location_add_more': - $form_state['#location_needed'] = TRUE; - if (isset($form_state['values']['location']['actor']['location_actor_label']) && $form_state['values']['location']['actor']['location_actor_label']) { - $form_state['#location_actor_label'] = $form_state['values']['location']['actor']['location_actor_label']; - } - - break; - case 'actor_add_more': $form_state['#actor_needed'] = TRUE; if (isset($form_state['input']['organiser']['actor']['organiser_actor_label']) && $form_state['input']['organiser']['actor']['organiser_actor_label']) { @@ -277,40 +269,30 @@ function culturefeed_entry_ui_add_more_js($form, $form_state) { switch ($form_state['input']['_triggering_element_name']) { - case 'location[new][citywrapper][country_select]': - return $form['basic']['location']['new']['citywrapper']; - case 'links_add_more': return $form['extra']['links']; case 'opening_times_add_more': return $form['basic']['period_or_permanent']['opening_times']; - + case 'price_add_more': return $form['extra']['price']['extra']; - + case 'ld_add_more': return $form['extra']['description']['ld']; - - case 'location_add_more': - //$form['basic']['location']['add_new_location']['#attributes'] = array('style' => array('display:none;')); - return $form['basic']['location']; - + case 'actor_add_more': return $form['extra']['organiser']; - + case 'performers_add_more': return $form['extra']['performers']['wrapper']; - + case 'contacts_add_more': return $form['extra']['contacts']['wrapper']; - + case 'languages_add_more': return $form['extra']['language']['wrapper']; - - case 'location[actor][location_actor_id]': - return $form['basic']['location']['actor']; - + case 'organiser_actor_id': return $form['extra']['organiser']['actor']; } diff --git a/culturefeed_entry_ui/culturefeed_location_control/culturefeed_location_control.info b/culturefeed_entry_ui/culturefeed_location_control/culturefeed_location_control.info new file mode 100644 index 00000000..00612f51 --- /dev/null +++ b/culturefeed_entry_ui/culturefeed_location_control/culturefeed_location_control.info @@ -0,0 +1,5 @@ +name = CultureFeed Entry UI Location control +description = Form element to manage locations in the Entry UI. +package = CultureFeed +version = VERSION +core = 7.x diff --git a/culturefeed_entry_ui/culturefeed_location_control/culturefeed_location_control.module b/culturefeed_entry_ui/culturefeed_location_control/culturefeed_location_control.module new file mode 100644 index 00000000..90cee499 --- /dev/null +++ b/culturefeed_entry_ui/culturefeed_location_control/culturefeed_location_control.module @@ -0,0 +1,113 @@ + 'ajax', + '#commands' => ajax_prepare_response($output), + ); + return $result; + +} + +/** + * Checks if the triggering element is part of the element. + * + * @todo move to a more general module, culturefeed date control does the same. + * + * @param array $triggering_element + * The triggering element. + * @param array $element + * The element. + * + * @return bool + * True or false. + */ +function culturefeed_location_control_check_trigger_element(array $triggering_element, array $element) { + return array_intersect($triggering_element['#parents'], $element['#parents']) == $element['#parents']; +} + +/** + * Implements hook_element_info(). + * + * This is a complex ajax driven form element. Several new ajax buttons are + * added based on initial interaction or default value. Most of the logic is + * taken from the core managed file field. + * + * - To ensure all buttons remain registered in the form, visibility is set + * through access in a pre render function. + * - Element validation functions are used to set the data. + * - A custom ajax callback path to ensure the form is rerenderd. + * + * @see file_managed_file_pre_render() + * @see file_managed_file_value() + */ +function culturefeed_location_control_element_info() { + + return array( + 'culturefeed_location_control' => array( + '#element_validate' => array('culturefeed_location_control_location_control_validate'), + '#input' => TRUE, + '#pre_render' => array('culturefeed_location_control_location_control_pre_render'), + '#process' => array('culturefeed_location_control_location_control_process', 'ajax_process_form'), + '#tree' => TRUE, + '#value_callback' => 'culturefeed_location_control_location_control_value_callback', + ), + 'culturefeed_location_control_asset' => array( + '#element_validate' => array('culturefeed_location_control_asset_validate'), + '#input' => TRUE, + '#process' => array('culturefeed_location_control_asset_process', 'ajax_process_form'), + '#tree' => TRUE, + '#value_callback' => 'culturefeed_location_control_asset_value_callback', + ), + 'culturefeed_location_control_custom' => array( + '#element_validate' => array('culturefeed_location_control_custom_validate'), + '#input' => TRUE, + '#pre_render' => array('culturefeed_location_control_custom_pre_render'), + '#process' => array('culturefeed_location_control_custom_process', 'ajax_process_form'), + '#tree' => TRUE, + '#value_callback' => 'culturefeed_location_control_custom_value_callback', + ), + ); + +} + +/** + * Implements hook_menu(). + * + * @todo move to a more general module, culturefeed date control does the same. + */ +function culturefeed_location_control_menu() { + + return array( + 'culturefeed_elements/location/ajax' => array( + 'title' => 'AHAH callback', + 'page callback' => 'culturefeed_location_control_ajax_callback', + 'delivery callback' => 'ajax_deliver', + 'access callback' => TRUE, + 'theme callback' => 'ajax_base_page_theme', + 'type' => MENU_CALLBACK, + ), + ); + +} diff --git a/culturefeed_entry_ui/culturefeed_location_control/form/asset.inc b/culturefeed_entry_ui/culturefeed_location_control/form/asset.inc new file mode 100644 index 00000000..8f4ff745 --- /dev/null +++ b/culturefeed_entry_ui/culturefeed_location_control/form/asset.inc @@ -0,0 +1,163 @@ +"; + $element['#suffix'] = "
    "; + + if (isset($element['#location_control'])) { + $element_id = $element['#location_control']['#id']; + $array_parents = $element['#location_control']['#array_parents']; + } + + $asset = $element['#value']; + + $ajax_settings = array( + 'effect' => 'none', + 'path' => 'culturefeed_elements/location/ajax/' . implode('/', $array_parents), + 'progress' => array('type' => 'throbber'), + 'wrapper' => $element_id . '-ajax-wrapper', + ); + + $ajax_button = array( + '#access' => TRUE, + '#ajax' => $ajax_settings, + '#attributes' => array( + 'class' => array('add-more-link btn-link'), + ), + '#limit_validation_errors' => array($element['#parents']), + '#submit' => array('culturefeed_location_control_location_control_submit'), + '#type' => 'submit', + ); + + $element['label'] = array( + '#autocomplete_path' => 'autocomplete/culturefeed/actor-suggestions/all', + '#default_value' => isset($asset['label']) ? $asset['label'] : '', + '#required' => FALSE, + '#size' => 80, + '#title' => t('Location'), + '#type' => 'textfield', + ); + if ($asset['id']) { + $element['label']['#attributes']['readonly'] = 'readonly'; + } + + // @see culturefeed_entry_ui.js. + $element['id'] = array( + '#attributes' => array( + 'id' => 'location_actor_id', + ), + '#default_value' => isset($asset['id']) ? $asset['id'] : '', + '#type' => 'hidden', + ); + + $element['asset_remove'] = $ajax_button + array( + '#id' => 'location_asset_remove', + '#name' => 'asset_remove', + '#value' => t('Remove address'), + ); + if (!$asset['id']) { + $element['asset_remove']['#attributes']['style'] = 'display: none;'; + } + + $element['new'] = $ajax_button + array( + '#id' => 'location_custom_add', + '#name' => 'new', + '#value' => t('Location not found, add location'), + ); + $element['new']['#attributes']['style'] = 'display: none;'; + + return $element; + +} + +/** + * Validate and alter the culturefeed location control asset form values. + * + * @param array $element + * The element. + * @param array $form_state + * The form state. + */ +function culturefeed_location_control_asset_validate(array &$element, array &$form_state) { + + $triggering_element = (isset($form_state['triggering_element'])) ? $form_state['triggering_element'] : ''; + $triggering_parent = array_pop($triggering_element['#parents']); + $asset = $element['#value']; + + if (culturefeed_location_control_check_trigger_element($triggering_element, $element)) { + + switch ($triggering_parent) { + + case 'asset_remove': + + $asset['id'] = ''; + $asset['label'] = ''; + + } + + drupal_array_set_nested_value($form_state['input'], $element['#parents'], $asset); + + } + +} + +/** + * Value callback for the culturefeed location control asset element. + * + * @param array $element + * The element. + * @param mixed $input + * The input. + * @param array $form_state + * The form state. + * + * @return mixed + * The value. + */ +function culturefeed_location_control_asset_value_callback(array $element, $input, array $form_state) { + + if ($input) { + return $input; + } + else { + + $value = array( + 'id' => '', + 'label' => '', + ); + + if (isset($element['#default_value']) && $element['#default_value']) { + + $default_value = $element['#default_value']; + $value['id'] = $default_value['id']; + $value['label'] = $default_value['label']; + + } + + return $value; + + } + +} diff --git a/culturefeed_entry_ui/culturefeed_location_control/form/custom.inc b/culturefeed_entry_ui/culturefeed_location_control/form/custom.inc new file mode 100644 index 00000000..e1553563 --- /dev/null +++ b/culturefeed_entry_ui/culturefeed_location_control/form/custom.inc @@ -0,0 +1,223 @@ +"; + $element['#suffix'] = ""; + + $custom = $element['#value']; + + $ajax_settings = array( + 'effect' => 'none', + 'path' => 'culturefeed_elements/location/ajax/' . implode('/', $array_parents), + 'progress' => array('type' => 'throbber'), + 'wrapper' => $element_id . '-ajax-wrapper', + ); + + $country = isset($custom['country']) && $custom['country'] ? $custom['country'] : 'BE'; + + $element['title'] = array( + '#type' => 'textfield', + '#title' => t('Location Title'), + '#default_value' => isset($custom['title']) ? $custom['title'] : '', + '#required' => FALSE, + '#size' => 80, + ); + + $element['country'] = array( + '#ajax' => $ajax_settings, + '#default_value' => $country, + '#required' => FALSE, + '#title' => t('Country'), + '#type' => 'select', + '#options' => country_get_list(), + ); + + $element['zip'] = array( + '#access' => TRUE, + '#attributes' => array( + 'style' => array('margin-right:30px;'), + ), + '#default_value' => isset($custom['zip']) ? $custom['zip'] : '', + '#required' => FALSE, + '#size' => 10, + '#title' => t('ZIP Code'), + '#type' => 'textfield', + ); + + $element['city'] = array( + '#autocomplete_path' => ($country == 'BE') ? 'autocomplete/culturefeed/city-suggestion' : '', + '#default_value' => isset($custom['city']) ? $custom['city'] : '', + '#required' => FALSE, + '#size' => 60, + '#title' => t('City'), + '#type' => 'textfield', + ); + + $element['street'] = array( + '#default_value' => isset($custom['street']) ? $custom['street'] : '', + '#required' => FALSE, + '#size' => 60, + '#title' => ($country == 'BE') ? t('Street') : t('Street and House Number'), + '#type' => 'textfield', + ); + + $element['number'] = array( + '#access' => TRUE, + '#default_value' => isset($custom['number']) ? $custom['number'] : '', + '#required' => FALSE, + '#size' => 10, + '#title' => t('House Number'), + '#type' => 'textfield', + ); + + if (isset($element['#location_control'])) { + $element_id = $element['#location_control']['#id']; + $array_parents = $element['#location_control']['#array_parents']; + } + + $element['custom_remove'] = array( + '#access' => TRUE, + '#ajax' => array( + 'path' => 'culturefeed_elements/location/ajax/' . implode('/', $array_parents), + 'wrapper' => $element_id . '-ajax-wrapper', + ) + $ajax_settings, + '#attributes' => array('class' => array('add-more-link btn-link')), + '#limit_validation_errors' => array($element['#parents']), + '#name' => 'custom_remove', + '#submit' => array('culturefeed_location_control_location_control_submit'), + '#type' => 'submit', + '#value' => t('Remove address'), + ); + + return $element; + +} + +/** + * Validate and alter the culturefeed location control custom form values. + * + * @param array $element + * The element. + * @param array $form_state + * The form state. + */ +function culturefeed_location_control_custom_validate(array &$element, array &$form_state) { + + $triggering_element = (isset($form_state['triggering_element'])) ? $form_state['triggering_element'] : ''; + $triggering_parent = array_pop($triggering_element['#parents']); + $custom = $element['#value']; + + if (culturefeed_location_control_check_trigger_element($triggering_element, $element)) { + + switch ($triggering_parent) { + + case 'custom_remove': + + $custom['city'] = ''; + $custom['country'] = ''; + $custom['number'] = ''; + $custom['street'] = ''; + $custom['title'] = ''; + $custom['zip'] = ''; + + } + + drupal_array_set_nested_value($form_state['input'], $element['#parents'], $custom); + + } + +} + +/** + * Value callback for the culturefeed location control custom element. + * + * @param array $element + * The element. + * @param mixed $input + * The input. + * @param array $form_state + * The form state. + * + * @return mixed + * The value. + */ +function culturefeed_location_control_custom_value_callback(array $element, $input, array $form_state) { + + if ($input) { + return $input; + } + else { + + $value = array( + 'city' => '', + 'country' => '', + 'number' => '', + 'street' => '', + 'title' => '', + 'zip' => '', + ); + + if (isset($element['#default_value']) && $element['#default_value']) { + + $default_value = $element['#default_value']; + $value['city'] = $default_value['city']; + $value['country'] = $default_value['country']; + $value['number'] = $default_value['number']; + $value['street'] = $default_value['street']; + $value['title'] = $default_value['title']; + $value['zip'] = $default_value['zip']; + + } + + return $value; + + } + +} diff --git a/culturefeed_entry_ui/culturefeed_location_control/form/location_control.inc b/culturefeed_entry_ui/culturefeed_location_control/form/location_control.inc new file mode 100644 index 00000000..f62e4e5c --- /dev/null +++ b/culturefeed_entry_ui/culturefeed_location_control/form/location_control.inc @@ -0,0 +1,198 @@ + array( + 'id' => $element['#id'] . '-ajax-wrapper', + ), + '#type' => 'container', + ); + + // Type. + $element['location_control']['type'] = array( + '#type' => 'hidden', + '#value' => $location_control['type'], + ); + + // Asset. + $element['location_control']['asset'] = array( + '#access' => TRUE, + '#default_value' => isset($location_control['asset']) ? $location_control['asset'] : '', + '#location_control' => $element, + '#type' => 'culturefeed_location_control_asset', + ); + + // Custom. + $element['location_control']['custom'] = array( + '#access' => TRUE, + '#default_value' => isset($location_control['custom']) ? $location_control['custom'] : '', + '#location_control' => $element, + '#type' => 'culturefeed_location_control_custom', + ); + + return $element; + +} + +/** + * Submit handler for the ajax buttons. + * + * @param array $form + * The form. + * @param array $form_state + * The form state. + */ +function culturefeed_location_control_location_control_submit(array $form, array &$form_state) { + + $form_state['rebuild'] = TRUE; + +} + +/** + * Validate and alter the culturefeed location control form values. + * + * This is where the element switching is set, based on values. + * + * @param array $element + * The element. + * @param array $form_state + * The form state. + */ +function culturefeed_location_control_location_control_validate(array $element, array &$form_state) { + + $triggering_element = (isset($form_state['triggering_element'])) ? $form_state['triggering_element'] : ''; + $triggering_parent = array_pop($triggering_element['#parents']); + + // Use form_state instead of element as individual sub elements have changes + // that won't be reflected in element. + $values = drupal_array_get_nested_value($form_state['input'], $element['#parents']); + $location_control = $values['location_control']; + + if (culturefeed_location_control_check_trigger_element($triggering_element, $element)) { + + $type = $location_control['type']; + + // Custom. + if ($triggering_parent == 'new') { + + $type = 'custom'; + if (isset($location_control['asset']['label']) && $location_control['asset']['label']) { + $location_control['custom']['title'] = $location_control['asset']['label']; + } + + } + + // Remove. + if ($triggering_parent == 'asset_remove' || $triggering_parent == 'custom_remove') { + + $type = 'asset'; + + } + + $location_control['type'] = $type; + $element['#parents'][] = 'location_control'; + + drupal_array_set_nested_value($form_state['input'], $element['#parents'], $location_control); + } + +} + +/** + * Value callback for the location control element. + * + * @param array $element + * The element. + * @param mixed $input + * The input. + * @param array $form_state + * The form state. + * + * @return mixed + * The value. + */ +function culturefeed_location_control_location_control_value_callback(array &$element, $input, array $form_state) { + + if ($input) { + return $input; + } + else { + + $value = array( + 'location_control' => array( + 'type' => 'asset', + 'asset' => array(), + 'custom' => array(), + ), + ); + + if (isset($element['#default_value']) && $element['#default_value']) { + + $location_control = $value['location_control']; + $default_value = $element['#default_value']; + + // Asset. + if ($default_value['asset']['id']) { + $location_control['asset'] = $default_value['asset']; + $location_control['type'] = 'asset'; + } + + // Custom. + if ($default_value['custom']['title']) { + $location_control['custom'] = $default_value['custom']; + $location_control['type'] = 'custom'; + } + + $value['location_control'] = $location_control; + + } + + return $value; + + } + +} diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 63711472..217edbde 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -17,14 +17,6 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { $category_defaults = array(); $eventtype_default = ''; $themetype_default = ''; - $default_location_label = ''; - $default_location_id = ''; - $custom_location_title = ''; - $custom_location_street = ''; - $custom_location_number = ''; - $custom_location_zip = ''; - $custom_location_city = ''; - $custom_location_country = ''; $default_organiser_label = ''; $default_organiser_id = ''; $publication_date = ''; @@ -49,11 +41,6 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { $form_state['#themes_needed'] = ''; } - if (!isset($form_state['#location_needed'])) { - $form_state['#location_needed'] = FALSE; - } - $form_state['#zip_needed'] = FALSE; - // Language vars $nl_title = ''; $nl_short_description = ''; @@ -96,27 +83,6 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { } } - // Default location. - if ($location = $event->getLocation()) { - $address = $location->getAddress()->getPhysicalAddress(); - if ($location->getCdbId()) { - $default_location_id = $location->getCdbId(); - $default_location_label = $location->getLabel(); - $form_state['#location_needed'] = FALSE; - } - else { - $form_state['#location_needed'] = TRUE; - $custom_location_title = $location->getLabel(); - $custom_location_street = $address->getStreet(); - $custom_location_number = $address->getHouseNumber(); - $custom_location_zip = $address->getZip(); - $custom_location_country = $address->getCountry(); - if ($custom_location_country == 'BE') { - $custom_location_city = $custom_location_zip . ' ' . $address->getCity(); - } - } - } - // Default organiser. if ($organiser = $event->getOrganiser()) { $default_organiser_label = $organiser->getLabel(); @@ -528,150 +494,9 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { ); } - $form['basic']['location'] = array( - '#prefix' => '
    ', - '#suffix' => '
    ', - '#type' => 'container', - '#tree' => TRUE, - ); - - if (!$form_state['#location_needed']) { - $form['basic']['location']['actor'] = array( - '#tree' => TRUE, - '#type' => 'container', - '#prefix' => '
    ', - '#suffix' => '
    ', - ); - - $form['basic']['location']['actor']['location_actor_label'] = array( - '#type' => 'textfield', - '#title' => t('Location'), - '#autocomplete_path' => 'autocomplete/culturefeed/actor-suggestions/all', - '#required' => FALSE, - '#default_value' => isset($default_location_label) ? $default_location_label : '', - '#size' => 80, - ); - - $form['basic']['location']['actor']['location_actor_id'] = array( - '#id' => 'location_actor_id', - '#type' => 'hidden', - '#default_value' => isset($default_location_id) ? $default_location_id : '', - '#ajax' => array( - 'callback' => 'culturefeed_entry_ui_add_more_js', - 'wrapper' => 'location-ajax-wrapper', - 'event' => 'location_eventsearch', - ), - '#attributes' => array( - 'id' => 'location_actor_id', - ), - ); - } - - $form['basic']['location']['new'] = array( - '#tree' => TRUE, - '#type' => 'container', - '#prefix' => '
    ', - '#suffix' => '
    ', - ); - - if (!$form_state['#location_needed']) { - $form['basic']['location']['new']['add_new_location'] = array( - '#type' => 'submit', - '#name' => 'location_add_more', - '#value' => t('Location not found, add location'), - '#attributes' => array( - 'class' => array('add-more-link btn-link'), - 'style' => array('display:none'), - ), - '#ajax' => array( - 'callback' => 'culturefeed_entry_ui_add_more_js', - 'wrapper' => 'location-ajax-wrapper', - 'effect' => 'none', - ), - '#limit_validation_errors' => array(array('location')), - '#submit' => array('culturefeed_entry_ui_add_more_submit'), - ); - } - - if ($form_state['#location_needed']) { - - $country = isset($form_state['values']['location']['new']['citywrapper']['country_select']) && $form_state['values']['location']['new']['citywrapper']['country_select'] ? $form_state['values']['location']['new']['citywrapper']['country_select'] : ($custom_location_country ? $custom_location_country : 'BE'); - - $default_location_title = $custom_location_title ? $custom_location_title : ''; - if (isset($form_state['#location_actor_label'])) { - $default_location_title = $form_state['#location_actor_label']; - } - $form['basic']['location']['new']['location_title'] = array( - '#type' => 'textfield', - '#title' => t('Location Title'), - '#default_value' => $default_location_title, - '#required' => FALSE, - '#size' => 80, - ); - - $form['basic']['location']['new']['citywrapper'] = array( - '#tree' => TRUE, - '#type' => 'container', - '#prefix' => '
    ', - '#suffix' => '
    ', - ); - - $form['basic']['location']['new']['citywrapper']['country_select'] = array( - '#type' => 'select', - '#title' => t('Country'), - '#options' => country_get_list(), - '#default_value' => $custom_location_country ? $custom_location_country : 'BE', - '#required' => FALSE, - '#ajax' => array( - 'callback' => 'culturefeed_entry_ui_add_more_js', - 'wrapper' => 'citywrapper-ajax-wrapper', - 'effect' => 'none', - ), - ); - - $form['basic']['location']['new']['citywrapper']['zip_code'] = array( - '#type' => 'textfield', - '#title' => ($country == 'BE') ? '' : t('ZIP Code'), - '#default_value' => $custom_location_zip ? $custom_location_zip : '', - '#required' => FALSE, - '#size' => 10, - '#attributes' => array( - 'style' => array( - ($country == 'BE') ? 'display:none;' : 'display:block;margin-right:30px;', - ), - ), - ); - - $form['basic']['location']['new']['citywrapper']['city'] = array( - '#type' => 'textfield', - '#title' => t('City'), - '#default_value' => $custom_location_city ? $custom_location_city : '', - '#autocomplete_path' => ($country == 'BE') ? 'autocomplete/culturefeed/city-suggestion' : '', - '#required' => FALSE, - '#size' => 60, - ); - - $form['basic']['location']['new']['citywrapper']['street'] = array( - '#type' => 'textfield', - '#title' => ($country == 'BE') ? t('Street') : t('Street and House Number'), - '#default_value' => $custom_location_street ? $custom_location_street : '', - '#required' => FALSE, - '#size' => 60, - ); - - $form['basic']['location']['new']['citywrapper']['house_number'] = array( - '#type' => 'textfield', - '#title' => ($country == 'BE') ? t('House Number') : '', - '#default_value' => $custom_location_number ? $custom_location_number : '', - '#required' => FALSE, - '#size' => 10, - '#attributes' => array( - 'style' => array( - ($country == 'BE') ? 'display:block;' : 'display:none;', - ), - ), - ); - } + // Location control. + form_load_include($form_state, 'inc', 'culturefeed_entry_ui', 'includes/form/culturefeed_entry_ui.location'); + culturefeed_entry_ui_location_form($form, $form_state, $event); // Date control $form['basic']['when'] = array( @@ -1700,68 +1525,7 @@ function culturefeed_entry_ui_event_save_validate($form, &$form_state) { } // Validate location - if (isset($form_state['#location_needed']) && $form_state['#location_needed']) { - if (empty($values['location']['new']['location_title'])) { - form_set_error('location_title', t('A title is required for a custom location')); - } - /*if ($values['location']['new']['citywrapper']['country_select'] != 'BE') { - if (empty($values['location']['new']['citywrapper']['zip_code'])) { - form_set_error('basic[zip_code]', t('A zip code is required for a custom location')); - } - }*/ - if (empty($values['location']['new']['citywrapper']['city'])) { - form_set_error('city', t('A city is required for a custom location')); - } - else { - $available_city = culturefeed_search_get_city_suggestions($values['location']['new']['citywrapper']['city'], TRUE); - if (!isset($available_city[$values['location']['new']['citywrapper']['city']])) { - form_set_error('location][new][citywrapper][city', t('Please select a city from the list.')); - } - } - $location = NULL; - } - else { - try { - if ($values['location']['actor']['location_actor_label'] == '') { - form_set_error('location', t('A location is required.')); - } - else { - $location = culturefeed_search_item_load($values['location']['actor']['location_actor_id'], 'actor'); - if (!$location) { - form_set_error('location', t('We could not validate the location')); - } - } - } catch (Exception $e) { - form_set_error('location', t('We could not validate the location')); - } - } - - - /*if (!empty($values['location']['actor']['location_actor_id'])) { - - try { - $location = culturefeed_search_item_load($values['location']['actor']['location_actor_id'], 'actor'); - if (!$location) { - form_set_error('location', t('We could not validate the location')); - } - } catch (Exception $e) { - form_set_error('location', t('We could not validate the location')); - } - } - else { - if (empty($values['location']['location_title'])) { - form_set_error('location_title', t('A title is required for a custom location')); - } - if ($values['location']['citywrapper']['country'] != 'BE') { - if (empty($values['location']['citywrapper']['zip_code'])) { - form_set_error('basic[zip_code]', t('A zip code is required for a custom location')); - } - } - if (empty($values['location']['citywrapper']['city'])) { - form_set_error('city', t('A city is required for a custom location')); - } - $location = NULL; - }*/ + $location = culturefeed_entry_ui_location_form_validate($form, $form_state); // Validate Links $i = 0; @@ -2210,56 +1974,8 @@ function _culturefeed_entry_ui_ui_event_form_save_event($form, &$form_state, Cul $event->setDetails($details); - // Asset Location / Address. - if ($location) { - $addresses = $location->getEntity()->getContactInfo()->getAddresses(); - - /* @var CultureFeed_Cdb_Data_Address $address */ - $address = $addresses[0]; - $location_detail = $location->getEntity()->getDetails() - ->getDetailByLanguage(culturefeed_search_get_preferred_language()); - if (!$location_detail) { - $location_detail = $location->getEntity()->getDetails() - ->getDetailByLanguage("nl"); - } - - $cdb_location = new CultureFeed_Cdb_Data_Location($address); - $cdb_location->setLabel($location_detail->getTitle()); - $cdb_location->setCdbid($location->getEntity()->getCdbId()); - $event->setLocation($cdb_location); - } - else { - $address = new CultureFeed_Cdb_Data_Address(); - $physical_address = new CultureFeed_Cdb_Data_Address_PhysicalAddress(); - $physical_address->setStreet($values['location']['new']['citywrapper']['street']); - if ($values['location']['new']['citywrapper']['country_select'] == 'BE') { - $physical_address->setHouseNumber($values['location']['new']['citywrapper']['house_number']); - } - else { - $physical_address->setHouseNumber(''); - } - if ($values['location']['new']['citywrapper']['country_select'] == 'BE') { - $physical_address->setZip(substr($values['location']['new']['citywrapper']['city'], 0, 4)); - $physical_address->setCity(substr($values['location']['new']['citywrapper']['city'], 5)); - } - else { - $physical_address->setCity($values['location']['new']['citywrapper']['city']); - if(empty($values['location']['new']['citywrapper']['zip_code'])) { - $physical_address->setZip('0000'); - } - else { - $physical_address->setZip($values['location']['new']['citywrapper']['zip_code']); - } - } - $physical_address->setCountry($values['location']['new']['citywrapper']['country_select']); - $address->setLabel($values['location']['new']['location_title']); - $address->setPhysicalAddress($physical_address); - $address->setLabel($values['location']['new']['location_title']); - - $cdb_location = new CultureFeed_Cdb_Data_Location($address); - $cdb_location->setLabel($values['location']['new']['location_title']); - $event->setLocation($cdb_location); - } + // Location. + $address = culturefeed_entry_ui_location_form_save($event, $location, $form_state); // Event organiser. if ($organiser) { diff --git a/culturefeed_entry_ui/includes/form/culturefeed_entry_ui.location.inc b/culturefeed_entry_ui/includes/form/culturefeed_entry_ui.location.inc new file mode 100644 index 00000000..643b05c5 --- /dev/null +++ b/culturefeed_entry_ui/includes/form/culturefeed_entry_ui.location.inc @@ -0,0 +1,246 @@ +getLocation()) { + + if ($location->getCdbId()) { + $default_location_id = $location->getCdbId(); + $default_location_label = $location->getLabel(); + } + else { + + $address = $location->getAddress()->getPhysicalAddress(); + $custom_location_title = $location->getLabel(); + $custom_location_street = $address->getStreet(); + $custom_location_number = $address->getHouseNumber(); + $custom_location_zip = $address->getZip(); + $custom_location_country = $address->getCountry(); + if ($custom_location_country == 'BE') { + $custom_location_city = $custom_location_zip . ' ' . $address->getCity(); + } + + } + + } + + } + + // Form element. + $form['basic']['location'] = array( + '#type' => 'culturefeed_location_control', + '#default_value' => array( + 'asset' => array( + 'id' => $default_location_id, + 'label' => $default_location_label, + ), + 'custom' => array( + 'city' => $custom_location_city, + 'country' => $custom_location_country, + 'number' => $custom_location_number, + 'street' => $custom_location_street, + 'title' => $custom_location_title, + 'zip' => $custom_location_zip, + ), + ), + ); + +} + +/** + * Validation handler for the location. + * + * @param array $form + * The form. + * @param array $form_state + * The form state. + * + * @return mixed + * The location, NULL or \CultuurNet\Search\ActivityStatsExtendedEntity + */ +function culturefeed_entry_ui_location_form_validate(array $form, array &$form_state) { + + $values = array( + 'type' => '', + 'asset' => array(), + 'custom' => array(), + ); + + if (isset($form_state['values']['location']['location_control'])) { + $values = $form_state['values']['location']['location_control']; + } + + $location = NULL; + + // Custom. + if ($values['type'] == 'custom') { + + if (empty($values['custom']['title'])) { + form_set_error('location][location_control][custom][title', t('A title is required for a custom location')); + } + + if (empty($values['custom']['city'])) { + form_set_error('location][location_control][custom][city', t('A city is required for a custom location')); + } + else { + + // If an existing event is edited, the main city is not shown. + $available_cities = culturefeed_search_get_city_suggestions($values['custom']['city'], TRUE); + $cities = array(); + $pattern = '/ \(.*?\)/'; + foreach ($available_cities as $available_city) { + $cities[] = preg_replace($pattern, '', $available_city); + } + $city = preg_replace($pattern, '', $values['custom']['city']); + if (!in_array($city, $cities)) { + form_set_error('location[location_control][custom][city', t('Please select a city from the list.')); + } + + } + + } + + elseif ($values['type'] == 'asset') { + + try { + + if ($values['asset']['label'] == '') { + form_set_error('location', t('A location is required.')); + } + else { + $location = culturefeed_search_item_load($values['asset']['id'], 'actor'); + if (!$location) { + form_set_error('location', t('We could not validate the location')); + } + } + + } + + catch (Exception $e) { + form_set_error('location', t('We could not validate the location')); + } + + } + + return $location; + +} + +/** + * Save handler for the location. + * + * @param \CultureFeed_Cdb_Item_Event $event + * The event. + * @param mixed $location + * NULL or \CultuurNet\Search\ActivityStatsExtendedEntity. + * @param array $form_state + * The form state. + * + * @return \CultureFeed_Cdb_Data_Address + * The address. + */ +function culturefeed_entry_ui_location_form_save(\CultureFeed_Cdb_Item_Event &$event, $location, array $form_state) { + + $values = array( + 'type' => '', + 'asset' => array(), + 'custom' => array(), + ); + + if (isset($form_state['values']['location']['location_control'])) { + $values = $form_state['values']['location']['location_control']; + } + + $address = NULL; + + // Asset Location / Address. + if ($location) { + + $addresses = $location->getEntity()->getContactInfo()->getAddresses(); + + /* @var CultureFeed_Cdb_Data_Address $address */ + $address = $addresses[0]; + $location_detail = $location->getEntity()->getDetails() + ->getDetailByLanguage(culturefeed_search_get_preferred_language()); + if (!$location_detail) { + $location_detail = $location->getEntity()->getDetails() + ->getDetailByLanguage("nl"); + } + + $cdb_location = new CultureFeed_Cdb_Data_Location($address); + $cdb_location->setLabel($location_detail->getTitle()); + $cdb_location->setCdbid($location->getEntity()->getCdbId()); + $event->setLocation($cdb_location); + } + + else { + + $address = new CultureFeed_Cdb_Data_Address(); + $physical_address = new CultureFeed_Cdb_Data_Address_PhysicalAddress(); + + // Street and number. + $physical_address->setStreet($values['custom']['street']); + if ($values['custom']['country'] == 'BE') { + $physical_address->setHouseNumber($values['custom']['number']); + } + else { + $physical_address->setHouseNumber(''); + } + + // Zip and city. + if ($values['custom']['country'] == 'BE') { + $physical_address->setZip(substr($values['custom']['city'], 0, 4)); + $physical_address->setCity(substr($values['custom']['city'], 5)); + } + else { + $physical_address->setCity($values['custom']['city']); + if (empty($values['custom']['zip'])) { + $physical_address->setZip('0000'); + } + else { + $physical_address->setZip($values['custom']['zip']); + } + } + + // Country. + $physical_address->setCountry($values['custom']['country']); + + $address->setLabel($values['custom']['title']); + $address->setPhysicalAddress($physical_address); + + $cdb_location = new CultureFeed_Cdb_Data_Location($address); + $cdb_location->setLabel($values['custom']['title']); + $event->setLocation($cdb_location); + + } + + return $address; + +} diff --git a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js index 1d1effe5..e0aff99c 100644 --- a/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js +++ b/culturefeed_entry_ui/js/bootstrap_autocomplete_override.js @@ -1,129 +1,151 @@ jQuery(function($) { - /** - * Fills the suggestion popup with any matches received. - */ - Drupal.jsAC.prototype.found = function (matches) { - // If no value in the textfield, do not show the popup. - if (!this.input.value.length) { - return false; - } + /** + * Fills the suggestion popup with any matches received. + */ + Drupal.jsAC.prototype.found = function (matches) { - // Prepare matches. - var ul = $(''); - var ac = this; - ul.css({ - display: 'block', - right: 0 - }); - for (key in matches) { - - var value; - if (typeof(matches[key]) == "string") { - value = matches[key]; - $('
  • ') - .html($('').html(value).click(function (e) { e.preventDefault(); })) - .mousedown(function () { ac.select(this); }) - .mouseover(function () { ac.highlight(this); }) - .mouseout(function () { ac.unhighlight(this); }) - .data('autocompleteValue', value) - .appendTo(ul); - } - else if (typeof(matches[key]) == "object") { - value = matches[key].locationTitle; - $('
  • ') - .html($('').html(value).click(function (e) { e.preventDefault(); })) - .mousedown(function () { ac.select(this); }) - .mouseover(function () { ac.highlight(this); }) - .mouseout(function () { ac.unhighlight(this); }) - .data('autocompleteTitle', matches[key].title) - .data('autocompleteValue', matches[key].key) - .appendTo(ul); - } + // If no value in the textfield, do not show the popup. + if (!this.input.value.length) { + return false; + } + + // Prepare matches. + var ul = $(''); + var ac = this; + ul.css({ + display: 'block', + right: 0 + }); + for (key in matches) { + + var value; + + if (typeof(matches[key]) == "string") { + + value = matches[key]; + $('
  • ') + .html($('').html(value).click(function (e) { e.preventDefault(); })) + .mousedown(function () { ac.select(this); }) + .mouseover(function () { ac.highlight(this); }) + .mouseout(function () { ac.unhighlight(this); }) + .data('autocompleteValue', value) + .appendTo(ul); + + } + else if (typeof(matches[key]) == "object") { + + value = matches[key].locationTitle; + $('
  • ') + .html($('').html(value).click(function (e) { e.preventDefault(); })) + .mousedown(function () { ac.select(this); }) + .mouseover(function () { ac.highlight(this); }) + .mouseout(function () { ac.unhighlight(this); }) + .data('autocompleteTitle', matches[key].title) + .data('autocompleteValue', matches[key].key) + .appendTo(ul); + + } + + } + + // Show popup with matches, if any. + if (this.popup) { + + if (ul.children().length) { + + $(this.popup).empty().append(ul).show(); + $(this.ariaLive).html(Drupal.t('Autocomplete popup')); + if (this.input.name == 'organiser[actor][organiser_actor_label]') { + $('#edit-organiser-add-new-actor').css({ display: 'none' }); + } + if (this.input.name == 'location[location_control][asset][label]') { + $('#location_custom_add').hide(); } - // Show popup with matches, if any. - if (this.popup) { - if (ul.children().length) { - $(this.popup).empty().append(ul).show(); - $(this.ariaLive).html(Drupal.t('Autocomplete popup')); - if (this.input.name == 'organiser[actor][organiser_actor_label]') { - $('#edit-organiser-add-new-actor').css({ display: 'none' }); - } - if (this.input.name == 'location[actor][location_actor_label]') { - $('#edit-location-new-add-new-location').css({ display: 'none' }); - } - } - else { - $(this.popup).css({ visibility: 'hidden' }); - this.hidePopup(null, 'empty'); - if (this.input.name == 'organiser[actor][organiser_actor_label]') { - $('#edit-organiser-add-new-actor').css({ display: 'block' }); - $('#organiser_actor_id').val(''); - } - if (this.input.name == 'location[actor][location_actor_label]') { - $('#edit-location-new-add-new-location').css({ display: 'block' }); - $('#location_actor_id').val(''); - } - } + } + + else { + + $(this.popup).css({ visibility: 'hidden' }); + this.hidePopup(null, 'empty'); + + if (this.input.name == 'organiser[actor][organiser_actor_label]') { + $('#edit-organiser-add-new-actor').css({ display: 'block' }); + $('#organiser_actor_id').val(''); + } + if (this.input.name == 'location[location_control][asset][label]') { + $('#location_custom_add').show(); + $('#location_actor_id').val(''); } - }; - if (Drupal.ACDB) { - - /** - * Performs a cached and delayed search. - * Custom override: Don't show an error when people are navigation away of the site. - * - */ - Drupal.ACDB.prototype.search = function (searchString) { - var db = this; - searchString = searchString.replace(/^\s+|\s+$/, ''); - this.searchString = searchString; - - // See if this string needs to be searched for anyway. - if (searchString.length <= 0 || - searchString.charAt(searchString.length - 1) == ',') { - return; - } + } + + } + + }; + + if (Drupal.ACDB) { + + /** + * Performs a cached and delayed search. + * Custom override: Don't show an error when people are navigation away of the site. + * + */ + Drupal.ACDB.prototype.search = function (searchString) { + var db = this; + searchString = searchString.replace(/^\s+|\s+$/, ''); + this.searchString = searchString; - // See if this key has been searched for before. - if (this.cache[searchString]) { - return this.owner.found(this.cache[searchString]); + // See if this string needs to be searched for anyway. + if (searchString.length <= 0 || + searchString.charAt(searchString.length - 1) == ',') { + return; + } + + // See if this key has been searched for before. + if (this.cache[searchString]) { + return this.owner.found(this.cache[searchString]); + } + + // Initiate delayed search. + if (this.timer) { + clearTimeout(this.timer); + } + this.timer = setTimeout(function () { + + db.owner.setStatus('begin'); + + // Ajax GET request for autocompletion. We use Drupal.encodePath instead of + // encodeURIComponent to allow autocomplete search terms to contain slashes. + $.ajax({ + type: 'GET', + url: db.uri + '/' + Drupal.encodePath(searchString), + dataType: 'json', + + success: function (matches) { + if (typeof matches.status == 'undefined' || matches.status != 0) { + db.cache[searchString] = matches; + // Verify if these are still the matches the user wants to see. + if (db.searchString == searchString) { + db.owner.found(matches); + } + db.owner.setStatus('found'); } + }, - // Initiate delayed search. - if (this.timer) { - clearTimeout(this.timer); + error: function (xmlhttp) { + if (xmlhttp.status) { + alert(Drupal.ajaxError(xmlhttp, db.uri)); } - this.timer = setTimeout(function () { - db.owner.setStatus('begin'); - - // Ajax GET request for autocompletion. We use Drupal.encodePath instead of - // encodeURIComponent to allow autocomplete search terms to contain slashes. - $.ajax({ - type: 'GET', - url: db.uri + '/' + Drupal.encodePath(searchString), - dataType: 'json', - success: function (matches) { - if (typeof matches.status == 'undefined' || matches.status != 0) { - db.cache[searchString] = matches; - // Verify if these are still the matches the user wants to see. - if (db.searchString == searchString) { - db.owner.found(matches); - } - db.owner.setStatus('found'); - } - }, - error: function (xmlhttp) { - if (xmlhttp.status) { - alert(Drupal.ajaxError(xmlhttp, db.uri)); - } - } - }); - }, this.delay); - }; + } - } + }); + + }, this.delay); + + }; + + } }); diff --git a/culturefeed_entry_ui/js/culturefeed_entry_ui.js b/culturefeed_entry_ui/js/culturefeed_entry_ui.js index 855fa857..4cefa100 100644 --- a/culturefeed_entry_ui/js/culturefeed_entry_ui.js +++ b/culturefeed_entry_ui/js/culturefeed_entry_ui.js @@ -8,6 +8,7 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; (function ($) { Drupal.behaviors.price = { + attach: function (context, settings) { $(window).bind('load', function() { @@ -19,7 +20,7 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; $('#edit-price-extra-extra-info').val(''); } else { - //$('#edit-price-amount').val(''); + //$('#edit-price-amount').val(''); $('#edit-price-amount').removeAttr('disabled'); $('#edit-price-amount').css('color','#000'); $('#edit-price-extra').css('display','block'); @@ -27,7 +28,7 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; }); $('#edit-price-free').change(function () { - if($("#edit-price-free").attr("checked")==true) { + if($("#edit-price-free").attr("checked")==true) { $('#edit-price-amount').val('0'); $('#edit-price-amount').attr('disabled','disabled'); $('#edit-price-amount').css('color','#ccc'); @@ -35,7 +36,7 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; $('#edit-price-extra-extra-info').val(''); } else { - $('#edit-price-amount').val(''); + $('#edit-price-amount').val(''); $('#edit-price-amount').removeAttr('disabled'); $('#edit-price-amount').css('color','#000'); $('#edit-price-extra').css('display','block'); @@ -43,188 +44,222 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; }); $('#edit-location-actor-location-actor-label').change(function() { - if($('#edit-location-actor-location-actor-label').val() == '') { - $('#location_actor_id').val(''); + if($("[name='location[location_control][asset][label]']").val() == '') { + $('#location_actor_id').val(''); } }); $('#edit-organiser-actor-organiser-actor-label').change(function() { if($('#edit-organiser-actor-organiser-actor-label').val() == '') { - $('#organiser_actor_id').val(''); + $('#organiser_actor_id').val(''); } }); - - } + + } }; - /** - * Maxlength - */ - Drupal.behaviors.maxlength = { - attach: function (context, settings) { - $('#edit-description-sd-short-description').maxlength({ - max: 400, - feedbackTarget: '#edit-description-sd .help-block, #edit-description-sd .description' - }); - } + /** + * Maxlength + */ + Drupal.behaviors.maxlength = { + + attach: function (context, settings) { + $('#edit-description-sd-short-description').maxlength({ + max: 400, + feedbackTarget: '#edit-description-sd .help-block, #edit-description-sd .description' + }); } - /** - * Fire the autocomplete on paste. - */ - Drupal.behaviors.autocomplete_paste = { - attach: function () { - $('input.form-autocomplete, .form-autocomplete input.form-text').bind("input propertychange", function (event) { - $(this).trigger('keyup'); - }); - } + } + + /** + * Fire the autocomplete on paste. + */ + Drupal.behaviors.autocomplete_paste = { + + attach: function () { + $('input.form-autocomplete, .form-autocomplete input.form-text').bind("input propertychange", function (event) { + $(this).trigger('keyup'); + }); } - /** - * Hides the autocomplete suggestions. - */ - Drupal.jsAC.prototype.hidePopup = function (keycode, op) { - - // Select item if the right key or mousebutton was pressed. - if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) { - if ($(this.selected).data('autocompleteTitle') != undefined) { - - this.input.value = $(this.selected).data('autocompleteTitle'); - - if (this.input.name == 'location[actor][location_actor_label]') { - $('#location_actor_id').val($(this.selected).data('autocompleteValue')); - } - - if (this.input.name == 'organiser[actor][organiser_actor_label]') { - $('#organiser_actor_id').val($(this.selected).data('autocompleteValue')); - } - } - else { - this.input.value = $(this.selected).data('autocompleteValue'); - } + } - } + /** + * Hides the autocomplete suggestions. + */ + Drupal.jsAC.prototype.hidePopup = function (keycode, op) { - // Hide popup. - var popup = this.popup; - if (popup) { - this.popup = null; - $(popup).fadeOut('fast', function () { - $(popup).remove(); - }); + // Select item if the right key or mousebutton was pressed. + if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) { + + if ($(this.selected).data('autocompleteTitle') != undefined) { + + this.input.value = $(this.selected).data('autocompleteTitle'); + + if (this.input.name == 'location[location_control][asset][label]') { + $('#location_actor_id').val($(this.selected).data('autocompleteValue')); + $('#location_asset_remove').show(); + $(this.input).attr('readonly', 'readonly'); } - this.selected = false; - $(this.ariaLive).empty(); - // Workaround for bootstrap losing tabindex on autocomplete popup. - if ((!op || op != 'empty') && this.input.value) { - $(this.input).parents('.form-item').next().find(':tabbable').focus(); + if (this.input.name == 'organiser[actor][organiser_actor_label]') { + $('#organiser_actor_id').val($(this.selected).data('autocompleteValue')); } + } - }; + else { + this.input.value = $(this.selected).data('autocompleteValue'); + } - /** - * Fills the suggestion popup with any matches received. - */ - Drupal.jsAC.prototype.found = function (matches) { - // If no value in the textfield, do not show the popup. - if (!this.input.value.length) { - return false; - } + } - // Prepare matches. - var ul = $('
      '); - var ac = this; - for (key in matches) { - var row = matches[key]; - if (typeof(row) == "string") { - $('
    • ') - .html($('
      ').html(matches[key])) - .mousedown(function () { - ac.select(this); - }) - .mouseover(function () { - ac.highlight(this); - }) - .mouseout(function () { - ac.unhighlight(this); - }) - .data('autocompleteValue', key) - .appendTo(ul); - } - else if (typeof(row) == "object") { - $('
    • ') - .html($('
      ').html(row.locationTitle)) - .mousedown(function () { - ac.select(this); - }) - .mouseover(function () { - ac.highlight(this); - }) - .mouseout(function () { - ac.unhighlight(this); - }) - .data('autocompleteTitle', row.title) - //.data('autocompleteLocationTitle', 'TEST') - .data('autocompleteValue', row.key) - .appendTo(ul); - } - } + // Hide popup. + var popup = this.popup; + if (popup) { + + this.popup = null; + $(popup).fadeOut('fast', function () { + $(popup).remove(); + }); + + } + this.selected = false; + $(this.ariaLive).empty(); + + // Workaround for bootstrap losing tabindex on autocomplete popup. + if ((!op || op != 'empty') && this.input.value) { + $(this.input).parents('.form-item').next().find(':tabbable').focus(); + } + + }; + + /** + * Fills the suggestion popup with any matches received. + */ + Drupal.jsAC.prototype.found = function (matches) { + + // If no value in the textfield, do not show the popup. + if (!this.input.value.length) { + return false; + } - // Show popup with matches, if any. - if (this.popup) { - if (ul.children().length) { - $(this.popup).empty().append(ul).show(); - $(this.ariaLive).html(Drupal.t('Autocomplete popup')); - if (this.input.name == 'organiser[actor][organiser_actor_label]') { - $('#edit-organiser-add-new-actor').css({ display: 'none' }); - } - if (this.input.name == 'location[actor][location_actor_label]') { - $('#edit-location-new-add-new-location').css({ display: 'none' }); - } - } - else { - $(this.popup).css({ visibility: 'hidden' }); - this.hidePopup(); - if (this.input.name == 'organiser[actor][organiser_actor_label]') { - $('#edit-organiser-add-new-actor').css({ display: 'block' }); - $('#organiser_actor_id').val(''); - } - if (this.input.name == 'location[actor][location_actor_label]') { - $('#edit-location-new-add-new-location').css({ display: 'block' }); - $('#location_actor_id').val(''); - } - } + // Prepare matches. + var ul = $('
        '); + var ac = this; + for (key in matches) { + + var row = matches[key]; + + if (typeof(row) == "string") { + + $('
      • ') + .html($('
        ').html(matches[key])) + .mousedown(function () { + ac.select(this); + }) + .mouseover(function () { + ac.highlight(this); + }) + .mouseout(function () { + ac.unhighlight(this); + }) + .data('autocompleteValue', key) + .appendTo(ul); + + } + + else if (typeof(row) == "object") { + + $('
      • ') + .html($('
        ').html(row.locationTitle)) + .mousedown(function () { + ac.select(this); + }) + .mouseover(function () { + ac.highlight(this); + }) + .mouseout(function () { + ac.unhighlight(this); + }) + .data('autocompleteTitle', row.title) + .data('autocompleteValue', row.key) + .appendTo(ul); + + } + + } + + // Show popup with matches, if any. + if (this.popup) { + + if (ul.children().length) { + + $(this.popup).empty().append(ul).show(); + $(this.ariaLive).html(Drupal.t('Autocomplete popup')); + + if (this.input.name == 'organiser[actor][organiser_actor_label]') { + $('#edit-organiser-add-new-actor').css({ display: 'none' }); } - }; - - /** - * Puts the currently highlighted suggestion into the autocomplete field. - */ - Drupal.jsAC.prototype.select = function (node) { - if ($(node).data('autocompleteTitle') != undefined) { - this.input.value = $(node).data('autocompleteTitle'); - - if (this.input.name == 'location[actor][location_actor_label]') { - $('#location_actor_id').val($(node).data('autocompleteValue')); - } - - if (this.input.name == 'organiser[actor][organiser_actor_label]') { - $('#organiser_actor_id').val($(node).data('autocompleteValue')); - } - + if (this.input.name == 'location[location_control][asset][label]') { + $('#location_custom_add').hide(); } - else { - this.input.value = $(node).data('autocompleteValue'); + + } + + else { + + $(this.popup).css({ visibility: 'hidden' }); + this.hidePopup(); + + if (this.input.name == 'organiser[actor][organiser_actor_label]') { + $('#edit-organiser-add-new-actor').css({ display: 'block' }); + $('#organiser_actor_id').val(''); } - }; + if (this.input.name == 'location[location_control][asset][label]') { + $('#location_custom_add').show(); + $('#location_actor_id').val(''); + } + + } + + } + + }; + + /** + * Puts the currently highlighted suggestion into the autocomplete field. + */ + Drupal.jsAC.prototype.select = function (node) { + + if ($(node).data('autocompleteTitle') != undefined) { + + this.input.value = $(node).data('autocompleteTitle'); + + if (this.input.name == 'location[location_control][asset][label]') { + $('#location_actor_id').val($(node).data('autocompleteValue')); + $('#location_asset_remove').show(); + $(this.input).attr('readonly', 'readonly'); + } + + if (this.input.name == 'organiser[actor][organiser_actor_label]') { + $('#organiser_actor_id').val($(node).data('autocompleteValue')); + } + + } + + else { + this.input.value = $(node).data('autocompleteValue'); + } + + }; /** * Performs a cached and delayed search. */ - Drupal.ACDB.prototype.search = function (searchString) {console.log(searchString); + Drupal.ACDB.prototype.search = function (searchString) { var db = this; searchString = searchString.replace(/^\s+|\s+$/, ''); this.searchString = searchString; From 7be1758961ea73386909f254db37e86be280c264 Mon Sep 17 00:00:00 2001 From: HnLn Date: Wed, 25 Feb 2015 08:47:05 +0100 Subject: [PATCH 048/275] MSS-119 punt 4 ensure other changes still work --- .../culturefeed_location_control/form/location_control.inc | 1 + .../includes/culturefeed_entry_ui.pages.inc | 2 +- .../includes/form/culturefeed_entry_ui.location.inc | 2 +- culturefeed_entry_ui/js/culturefeed_entry_ui.js | 6 +++++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/culturefeed_entry_ui/culturefeed_location_control/form/location_control.inc b/culturefeed_entry_ui/culturefeed_location_control/form/location_control.inc index f62e4e5c..e212373d 100644 --- a/culturefeed_entry_ui/culturefeed_location_control/form/location_control.inc +++ b/culturefeed_entry_ui/culturefeed_location_control/form/location_control.inc @@ -48,6 +48,7 @@ function culturefeed_location_control_location_control_process(array $element, a $element['location_control'] = array( '#attributes' => array( + 'class' => array('clearfix'), 'id' => $element['#id'] . '-ajax-wrapper', ), '#type' => 'container', diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index 217edbde..5defd9e3 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -350,7 +350,7 @@ function culturefeed_entry_ui_event_form($form, &$form_state, $event = NULL) { // Eventtypes $form['basic']['what'] = array( '#type' => 'container', - '#prefix' => '
        ', + '#prefix' => '
        ', '#suffix' => '
        ' ); diff --git a/culturefeed_entry_ui/includes/form/culturefeed_entry_ui.location.inc b/culturefeed_entry_ui/includes/form/culturefeed_entry_ui.location.inc index 643b05c5..17739922 100644 --- a/culturefeed_entry_ui/includes/form/culturefeed_entry_ui.location.inc +++ b/culturefeed_entry_ui/includes/form/culturefeed_entry_ui.location.inc @@ -120,7 +120,7 @@ function culturefeed_entry_ui_location_form_validate(array $form, array &$form_s } $city = preg_replace($pattern, '', $values['custom']['city']); if (!in_array($city, $cities)) { - form_set_error('location[location_control][custom][city', t('Please select a city from the list.')); + form_set_error('location][location_control][custom][city', t('Please select a city from the list.')); } } diff --git a/culturefeed_entry_ui/js/culturefeed_entry_ui.js b/culturefeed_entry_ui/js/culturefeed_entry_ui.js index 4cefa100..7637fe45 100644 --- a/culturefeed_entry_ui/js/culturefeed_entry_ui.js +++ b/culturefeed_entry_ui/js/culturefeed_entry_ui.js @@ -131,7 +131,11 @@ Drupal.Culturefeed_entry_ui = Drupal.Culturefeed_entry_ui || {}; // Workaround for bootstrap losing tabindex on autocomplete popup. if ((!op || op != 'empty') && this.input.value) { - $(this.input).parents('.form-item').next().find(':tabbable').focus(); + + var inputs = $(this.input).closest('form').find(':input:visible'); + var index = inputs.index($(this.input)); + inputs.eq(index + 1).focus(); + } }; From 644331958ff562e6af6448259ab5df3708d75898 Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Thu, 26 Feb 2015 15:34:43 +0100 Subject: [PATCH 049/275] PWK-237 fix problem with lower cities --- culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc index f7aa8738..3ee4b8dc 100644 --- a/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc +++ b/culturefeed_entry_ui/includes/culturefeed_entry_ui.pages.inc @@ -1714,8 +1714,8 @@ function culturefeed_entry_ui_event_save_validate($form, &$form_state) { form_set_error('location][new][citywrapper][city', t('A city is required for a custom location')); } if ($values['location']['new']['citywrapper']['country_select'] == 'BE') { - $available_city = culturefeed_search_get_city_suggestions($values['location']['new']['citywrapper']['city'], TRUE); - if (!isset($available_city[$values['location']['new']['citywrapper']['city']])) { + $available_city = array_change_key_case(culturefeed_search_get_city_suggestions($values['location']['new']['citywrapper']['city'], TRUE)); + if (!isset($available_city[strtolower($values['location']['new']['citywrapper']['city'])])) { form_set_error('location][new][citywrapper][city', t('A valid city is required for a custom location.')); } } From 57bd831563ba2ef2ea35cb1664f2ee151a0f819a Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Mon, 2 Mar 2015 11:21:27 +0100 Subject: [PATCH 050/275] fix bug for anonymous users --- culturefeed_entry_ui/culturefeed_entry_ui.module | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/culturefeed_entry_ui/culturefeed_entry_ui.module b/culturefeed_entry_ui/culturefeed_entry_ui.module index 91680f66..f9e330d5 100644 --- a/culturefeed_entry_ui/culturefeed_entry_ui.module +++ b/culturefeed_entry_ui/culturefeed_entry_ui.module @@ -140,10 +140,12 @@ function culturefeed_entry_ui_menu_local_tasks_alter(&$data, $router_item, $root } $culturefeed_user = DrupalCultureFeed::getLoggedInUser(); - $ubd_permission = Drupalculturefeed_EntryApi::checkPermission($culturefeed_user->id, $culturefeed_user->mbox, array('ids' => $event->getId())); + if ($culturefeed_user) { + $ubd_permission = Drupalculturefeed_EntryApi::checkPermission($culturefeed_user->id, $culturefeed_user->mbox, array('ids' => $event->getId())); + } // Add tab for editing the event. - if (user_access('edit culturefeed events') && ($event->getEntity()->getCreatedBy() == $culturefeed_user->mbox || $ubd_permission[$event->getId()] == 'true')) { + if (user_access('edit culturefeed events') && ($event->getEntity()->getCreatedBy() == $culturefeed_user->mbox || (isset($ubd_permission) && $ubd_permission[$event->getId()] == 'true'))) { $link = array( 'href' => $path . '/edit', From b9799291e35a5e9678b7e83242914d20ed10fab2 Mon Sep 17 00:00:00 2001 From: Stijn Swaanen Date: Thu, 5 Mar 2015 16:16:30 +0100 Subject: [PATCH 051/275] UPS-1604 get only permanent card systems in promotions list --- culturefeed_uitpas/includes/profile_advantages.inc | 4 ++-- culturefeed_uitpas/includes/profile_promotions.inc | 5 +++-- culturefeed_uitpas/includes/promotions.inc | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/culturefeed_uitpas/includes/profile_advantages.inc b/culturefeed_uitpas/includes/profile_advantages.inc index 4035fbbb..957c052e 100644 --- a/culturefeed_uitpas/includes/profile_advantages.inc +++ b/culturefeed_uitpas/includes/profile_advantages.inc @@ -20,7 +20,7 @@ function culturefeed_uitpas_profile_advantages_get() { if ($uitpas_user->user && $uitpas_user->passholder) { $card_system_id = variable_get('culturefeed_uitpas_cardsystem_id'); - $uitpas_number = 0; + if ($card_system_id && isset($uitpas_user->passholder->cardSystemSpecific[$card_system_id]->currentCard->uitpasNumber)) { $uitpas_number = $uitpas_user->passholder->cardSystemSpecific[$card_system_id]->currentCard->uitpasNumber; } @@ -49,7 +49,7 @@ function culturefeed_uitpas_profile_advantages_get() { drupal_set_title(format_plural($uitpas_user->passholder->points, $singular, $plural), PASS_THROUGH); } - + // Solution csdco on from https://www.drupal.org/node/1049354 $_GET['q'] = 'promotions'; diff --git a/culturefeed_uitpas/includes/profile_promotions.inc b/culturefeed_uitpas/includes/profile_promotions.inc index 30bc0705..3e9a5adb 100644 --- a/culturefeed_uitpas/includes/profile_promotions.inc +++ b/culturefeed_uitpas/includes/profile_promotions.inc @@ -20,7 +20,7 @@ function culturefeed_uitpas_profile_promotions_get($filter = NULL) { if ($uitpas_user->user && $uitpas_user->passholder) { $card_system_id = variable_get('culturefeed_uitpas_cardsystem_id'); - $uitpas_number = 0; + if ($card_system_id && isset($uitpas_user->passholder->cardSystemSpecific[$card_system_id]->currentCard->uitpasNumber)) { $uitpas_number = $uitpas_user->passholder->cardSystemSpecific[$card_system_id]->currentCard->uitpasNumber; } @@ -128,7 +128,8 @@ function culturefeed_uitpas_profile_promotions_filter_sort($form, $form_state) { ); $cf = DrupalCultureFeed::getConsumerInstance(); - $card_systems = $cf->uitpas()->getCardSystems(); + $kind_of_card_systems = 'permanent'; + $card_systems = $cf->uitpas()->getCardSystems($kind_of_card_systems); $options = array(); foreach ($card_systems as $system) { diff --git a/culturefeed_uitpas/includes/promotions.inc b/culturefeed_uitpas/includes/promotions.inc index 3f35a7f7..8c8be13f 100644 --- a/culturefeed_uitpas/includes/promotions.inc +++ b/culturefeed_uitpas/includes/promotions.inc @@ -145,8 +145,8 @@ function culturefeed_uitpas_promotions_filter_sort($form, $form_state) { ); $cf = DrupalCultureFeed::getConsumerInstance(); - - $card_systems = $cf->uitpas()->getCardSystems(); + $kind_of_card_systems = 'permanent'; + $card_systems = $cf->uitpas()->getCardSystems($kind_of_card_systems); $options = array(); foreach ($card_systems as $system) { From 7d1c40300f49fdc3922de21ef393ed5b1c836295 Mon Sep 17 00:00:00 2001 From: Stijn Swaanen Date: Thu, 12 Mar 2015 12:29:35 +0100 Subject: [PATCH 052/275] put some countable data in the timestamp array --- culturefeed_agenda/includes/helpers.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/culturefeed_agenda/includes/helpers.inc b/culturefeed_agenda/includes/helpers.inc index baca80a8..d6e3d5d5 100644 --- a/culturefeed_agenda/includes/helpers.inc +++ b/culturefeed_agenda/includes/helpers.inc @@ -600,6 +600,8 @@ function culturefeed_agenda_parse_timestamps($timestamps) { $timestamps_array[$current_timestamp] = array( 'day' => date('D', strtotime($date)), 'date' => date('d/m', strtotime($date)), + 'year' => date('Y', strtotime($date)), + 'countable_date' => date('Y-m-d', strtotime($date)), ); if ($timestamp->getStartTime()) { $timestamps_array[$current_timestamp]['begintime'] = date('H:i', strtotime($timestamp->getStartTime())); From 2c0e7cbe25c91c9fff513e2aefa48d63a030a81e Mon Sep 17 00:00:00 2001 From: HnLn Date: Thu, 12 Mar 2015 14:16:32 +0100 Subject: [PATCH 053/275] MSS-135 fix paging in ajax --- culturefeed_uitpas/includes/promotions.inc | 46 ++++++++-------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/culturefeed_uitpas/includes/promotions.inc b/culturefeed_uitpas/includes/promotions.inc index 3f35a7f7..41193af4 100644 --- a/culturefeed_uitpas/includes/promotions.inc +++ b/culturefeed_uitpas/includes/promotions.inc @@ -57,42 +57,17 @@ function culturefeed_uitpas_promotions_get($filter = NULL) { } } - $tmp_q = $_GET['q']; // Store the current value of $_GET['q']. - $_GET['q'] = 'my/custom/callback'; // Change the value of $_GET['q'] to the "correct" path you want the pager to link to. - - pager_default_initialize($result->total, $promotions_max); - - - $_GET['q'] = $tmp_q; // Return $_GET['q'] to the proper value. - } catch (Exception $e) { watchdog_exception('culturefeed_uitpas_promotions', $e); - pager_default_initialize(0, $promotions_max); - - } - // Solution csdco on from https://www.drupal.org/node/1049354 - $_GET['q'] = 'promotions'; - - $promotions_pager_min = ($promotions_page * $promotions_max) + 1; - $promotions_pager_max = ($promotions_page * $promotions_max) + $promotions_max; - if ($promotions_pager_max > $promotions_total) { - $promotions_pager_max = $promotions_total; } return array( - array( - '#theme' => 'culturefeed_uitpas_promotions', - '#promotions' => $promotions, - '#promotions_total' => $promotions_total, - '#promotions_pager_min' => $promotions_pager_min, - '#promotions_pager_max' => $promotions_pager_max, - ), - array( - '#theme' => 'pager', - ), + '#theme' => 'culturefeed_uitpas_promotions', + '#promotions' => $promotions, + '#promotions_total' => $promotions_total, ); } @@ -148,6 +123,8 @@ function culturefeed_uitpas_promotions_filter_sort($form, $form_state) { $card_systems = $cf->uitpas()->getCardSystems(); + $filter = isset($form_state['values']['filter']) ? $form_state['values']['filter'] : (isset($_GET['filter']) ? $_GET['filter'] : NULL); + $options = array(); foreach ($card_systems as $system) { $options[$system->id] = $system->name; @@ -171,15 +148,26 @@ function culturefeed_uitpas_promotions_filter_sort($form, $form_state) { ), ); - $filter = isset($form_state['values']['filter']) ? $form_state['values']['filter'] : NULL; $results = culturefeed_uitpas_promotions_get($filter); $form['promotions']['result'] = array( '#markup' => drupal_render($results), ); + // Pager. + $promotions_max = variable_get('culturefeed_uitpas_promotions_promotions_max', 20); + + pager_default_initialize($results['#promotions_total'], $promotions_max); + + // Solution csdco on from https://www.drupal.org/node/1049354 + $tmp_q = $_GET['q']; + $_GET['q'] = 'promotions'; + $form['promotions']['pager']['#markup'] = theme('pager', array('parameters' => array('filter' => $filter))); + $_GET['q'] = $tmp_q; + $form['promotions']['#attached']['css'][] = drupal_get_path('module', 'culturefeed_uitpas') . '/css/culturefeed_uitpas.css'; return $form; + } function culturefeed_uitpas_promotions_ajax_callback($form, $form_state) { From 7989ba2e22d99acc39ef1cbeb1be39b806760d71 Mon Sep 17 00:00:00 2001 From: Stijn Swaanen Date: Mon, 16 Mar 2015 15:28:02 +0100 Subject: [PATCH 054/275] PWK-242, PWK-243 raw keywords and block of events of organiser. --- culturefeed_agenda/culturefeed_agenda.module | 28 ++++++++++++ culturefeed_agenda/includes/blocks.inc | 43 +++++++++++++++++++ ...ulturefeed-agenda-organiser-events.tpl.php | 15 +++++++ culturefeed_agenda/theme/theme.inc | 38 +++++++++++++++- 4 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 culturefeed_agenda/theme/culturefeed-agenda-organiser-events.tpl.php diff --git a/culturefeed_agenda/culturefeed_agenda.module b/culturefeed_agenda/culturefeed_agenda.module index 9686708f..15cfbc2d 100644 --- a/culturefeed_agenda/culturefeed_agenda.module +++ b/culturefeed_agenda/culturefeed_agenda.module @@ -134,6 +134,13 @@ function culturefeed_agenda_theme() { 'file' => 'theme.inc', ); + $theme['culturefeed_agenda_organiser_events'] = array( + 'variables' => array('items' => array(), 'organiser' => NULL), + 'template' => 'culturefeed-agenda-organiser-events', + 'path' => $path, + 'file' => 'theme.inc', + ); + return $theme; } @@ -384,6 +391,11 @@ function culturefeed_agenda_block_info() { 'cache' => DRUPAL_CACHE_PER_PAGE, ); + $blocks['agenda-organiser-events'] = array( + 'info' => t('Culturefeed agenda: Organiser events'), + 'cache' => DRUPAL_CACHE_PER_PAGE, + ); + return $blocks; } @@ -589,6 +601,14 @@ function culturefeed_agenda_block_configure($delta) { ); } + elseif ($delta == 'agenda-organiser-events') { + $form['agenda_organiser_event_amount'] = array( + '#title' => t('Amount of results to show'), + '#type' => 'textfield', + '#default_value' => variable_get('agenda_organiser_event_amount', 10), + '#description' => t('Enter the number of results to show in the block.'), + ); + } return $form; @@ -643,6 +663,11 @@ function culturefeed_agenda_block_save($delta, $edit) { } + elseif ($delta == 'agenda-organiser-events') { + + variable_set('agenda_organiser_event_amount', $edit['agenda_organiser_event_amount']); + } + } /** @@ -673,6 +698,9 @@ function culturefeed_agenda_block_view($delta) { case 'agenda-event-types': return culturefeed_agenda_block_event_types(); + + case 'agenda-organiser-events': + return culturefeed_agenda_block_organiser_events(); } return $block; diff --git a/culturefeed_agenda/includes/blocks.inc b/culturefeed_agenda/includes/blocks.inc index 971d2956..25cbd2a9 100644 --- a/culturefeed_agenda/includes/blocks.inc +++ b/culturefeed_agenda/includes/blocks.inc @@ -265,6 +265,49 @@ function culturefeed_agenda_search_block_form_submit($form, &$form_state) { } +function culturefeed_agenda_block_organiser_events() { + $item = culturefeed_agenda_get_active_object(); + if (!$item || $item->getType() == 'actor') { + return; + } + + $organiser_id = $item->getEntity()->getOrganiser()->getCdbid(); + $amount = variable_get('agenda_organiser_event_amount', 10); + + $parameters = array(); + $parameters[] = new \CultuurNet\Search\Parameter\Query('organiser_cdbid:' . $organiser_id); + $parameters[] = new \CultuurNet\Search\Parameter\FilterQuery('type:event OR type:production'); + $parameters[] = new \CultuurNet\Search\Parameter\Group(); + $parameters[] = new \CultuurNet\Search\Parameter\Rows($amount); + + try { + + $result = culturefeed_get_search_service()->search($parameters); + + if ($result->getTotalCount() == 0) { + return; + } + + } + catch (Exception $e) { + watchdog_exception('culturefeed_agenda', $e); + return; + } + + $content = array( + '#theme' => 'culturefeed_agenda_organiser_events', + '#organiser' => $item->getEntity()->getOrganiser(), + '#items' => $result->getItems(), + ); + + $block = array( + 'subject' => '', + 'content' => $content, + ); + + return $block; +} + /** * Show the upcoming program of current actor. */ diff --git a/culturefeed_agenda/theme/culturefeed-agenda-organiser-events.tpl.php b/culturefeed_agenda/theme/culturefeed-agenda-organiser-events.tpl.php new file mode 100644 index 00000000..92df2ea3 --- /dev/null +++ b/culturefeed_agenda/theme/culturefeed-agenda-organiser-events.tpl.php @@ -0,0 +1,15 @@ + + + +
          + +
        • + +
        +

        + diff --git a/culturefeed_agenda/theme/theme.inc b/culturefeed_agenda/theme/theme.inc index 2b89b4e5..ba38a67c 100644 --- a/culturefeed_agenda/theme/theme.inc +++ b/culturefeed_agenda/theme/theme.inc @@ -313,10 +313,12 @@ function _culturefeed_agenda_preprocess_agenda(&$variables) { $keywords = $cdb_item->getKeywords(); $variables['keywords'] = ''; - if ($keywords) { + if ($keywords) { + $variables['raw_keywords'] = array(); $linked_keywords = array(); foreach ($keywords as $keyword) { + $variables['raw_keywords'][] = $keyword; $linked_keywords[] = l($keyword, 'agenda/search', array('query' => array('keyword' => urlencode($keyword)))); } @@ -973,3 +975,37 @@ function theme_culturefeed_agenda_search_block_field_settings($variables) { return theme('table', $table_variables); } + +/** + * Preprocess the agenda organiser events block. + */ +function culturefeed_agenda_preprocess_culturefeed_agenda_organiser_events(&$variables) { + $items = array(); + foreach ($variables['items'] as $item) { + /*$items[] = theme('culturefeed_agenda_organiser_events_item', array( + 'item' => $item, + ));*/ + $type = $item->getType(); + if ($type == 'event') { + $type = 'e'; + } + else if ($type == 'production') { + $type = 'p'; + } + + $event = $item->getEntity(); + $event_detail = $event->getDetails()->getDetailByLanguage(culturefeed_search_get_preferred_language()); + + $title = $event_detail->getTitle(); + $cdbid = $event->getCdbid(); + + $items[] = '' . $title . ''; + } + $variables['items'] = $items; + + $organiser = $variables['organiser']->getLabel(); + $organiser_id = $variables['organiser']->getCdbid(); + $variables['organiser_link'] = '' . $organiser . ''; + + +} From d6d1f33703d4a848b5cd33112a5f9620b43382ae Mon Sep 17 00:00:00 2001 From: Jochen Stals Date: Mon, 23 Mar 2015 15:13:39 +0100 Subject: [PATCH 055/275] added culturefeed-agenda-event-types.tpl. --- .../culturefeed-agenda-event-types.tpl.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 culturefeed_agenda/theme/culturefeed-agenda-event-types.tpl.php diff --git a/culturefeed_agenda/theme/culturefeed-agenda-event-types.tpl.php b/culturefeed_agenda/theme/culturefeed-agenda-event-types.tpl.php new file mode 100644 index 00000000..ee24288e --- /dev/null +++ b/culturefeed_agenda/theme/culturefeed-agenda-event-types.tpl.php @@ -0,0 +1,21 @@ + + + $item) : ?> + +

        name; ?>

        + +
          + $child_item) : ?> +
        • name, 'agenda/search', array('query' => array('facet' => array('category_eventtype_id' => array($child_item['item']->tid))))); ?>
        • + +
        + + + From 9d80995bcca0d55d5bb019998000686737508dc6 Mon Sep 17 00:00:00 2001 From: Stijn Swaanen Date: Mon, 23 Mar 2015 15:38:20 +0100 Subject: [PATCH 056/275] UIV-1063 related activities settings, merge sort and sort direction into one field --- culturefeed_agenda/culturefeed_agenda.module | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/culturefeed_agenda/culturefeed_agenda.module b/culturefeed_agenda/culturefeed_agenda.module index 1672d02a..3596c023 100644 --- a/culturefeed_agenda/culturefeed_agenda.module +++ b/culturefeed_agenda/culturefeed_agenda.module @@ -424,20 +424,10 @@ function culturefeed_agenda_block_configure($delta) { $form['agenda_related_activities_sort'] = array( '#title' => t('Sort field'), '#type' => 'textfield', - '#default_value' => variable_get('agenda_related_activities_sort'), + '#default_value' => variable_get('agenda_related_activities_sort') . (!empty(variable_get('agenda_related_activities_sort_direction')) ? ' ' . variable_get('agenda_related_activities_sort_direction') : ''), '#description' => t('Field to sort on. Example startdate'), ); - $form['agenda_related_activities_sort_direction'] = array( - '#title' => t('Sort direction'), - '#type' => 'select', - '#options' => array( - \CultuurNet\Search\Parameter\Sort::DIRECTION_ASC => t('Ascending'), - \CultuurNet\Search\Parameter\Sort::DIRECTION_DESC => t('Descending'), - ), - '#default_value' => variable_get('agenda_related_activities_sort_direction', 'asc'), - ); - $form['agenda_related_activities_total_items'] = array( '#title' => t('Items to show'), '#type' => 'textfield', @@ -605,7 +595,7 @@ function culturefeed_agenda_block_save($delta, $edit) { variable_set('agenda_related_activities_range', $edit['agenda_related_activities_range']); variable_set('agenda_related_activities_extra_query', $edit['agenda_related_activities_extra_query']); variable_set('agenda_related_activities_sort', $edit['agenda_related_activities_sort']); - variable_set('agenda_related_activities_sort_direction', $edit['agenda_related_activities_sort_direction']); + variable_set('agenda_related_activities_sort_direction', ''); variable_set('agenda_related_activities_total_items', $edit['agenda_related_activities_total_items']); } From a981271ee62b290bc2c09dbc9161a1a47dcc3924 Mon Sep 17 00:00:00 2001 From: Sven Houtmeyers Date: Thu, 26 Mar 2015 14:13:58 +0100 Subject: [PATCH 057/275] PWK-252 fix actor suggestions --- culturefeed_search/includes/pages.inc | 48 ++++++------------- .../DrupalCultureFeedSearchService_Cache.php | 4 +- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/culturefeed_search/includes/pages.inc b/culturefeed_search/includes/pages.inc index dc55974e..a23e507a 100644 --- a/culturefeed_search/includes/pages.inc +++ b/culturefeed_search/includes/pages.inc @@ -19,42 +19,22 @@ function culturefeed_search_suggestions_autocomplete_page($search_string, $past try { $types = !empty($type) ? array($type) : array(); + $extra_parameters[] = !empty($all) ? new \CultuurNet\Search\Parameter\Parameter('admin','true') : array(); - if (!$all) { - // Get the list of suggestions from service. - $suggestions = culturefeed_get_search_service()->searchSuggestions($search_string, $types, $past); - if ($suggestions->hasSuggestions()) { - foreach ($suggestions as $suggestion) { - $title = $location_title = check_plain($suggestion->getTitle()); - $location = $suggestion->getLocation(); - if (!empty($location)) { - $location_title .= ' - (' . $location . ')'; - } - $object = new stdClass(); - $object->title = $title; - $object->key = $suggestion->getCdbId(); - $object->locationTitle = $location_title; - $matches[$suggestion->getCdbId()] = $object; - } - } - } - else { - $client = new Client(); - $client->setDefaultHeaders(array('Accept' => 'application/json')); - $body = json_decode($client->get('http://search-prod.lodgon.com/search/rest/search/suggest/item?title=' . $search_string . '&fq=type:actor%20asset:true')->send()->getBody(TRUE)); - if ($body->suggestions) { - foreach ($body->suggestions as $suggestion) { - $title = $location_title = check_plain($suggestion->value); - $location = $suggestion->zipcode; - if (!empty($location)) { - $location_title .= ' - (' . $location . ')'; - } - $object = new stdClass(); - $object->title = $title; - $object->key = $suggestion->cdbid; - $object->locationTitle = $location_title; - $matches[$suggestion->cdbid] = $object; + // Get the list of suggestions from service. + $suggestions = culturefeed_get_search_service()->searchSuggestions($search_string, $types, $past, $extra_parameters); + if ($suggestions->hasSuggestions()) { + foreach ($suggestions as $suggestion) { + $title = $location_title = check_plain($suggestion->getTitle()); + $location = $suggestion->getLocation(); + if (!empty($location)) { + $location_title .= ' - (' . $location . ')'; } + $object = new stdClass(); + $object->title = $title; + $object->key = $suggestion->getCdbId(); + $object->locationTitle = $location_title; + $matches[$suggestion->getCdbId()] = $object; } } diff --git a/culturefeed_search/lib/Drupal/DrupalCultureFeedSearchService_Cache.php b/culturefeed_search/lib/Drupal/DrupalCultureFeedSearchService_Cache.php index 2fe7f12b..79285f71 100644 --- a/culturefeed_search/lib/Drupal/DrupalCultureFeedSearchService_Cache.php +++ b/culturefeed_search/lib/Drupal/DrupalCultureFeedSearchService_Cache.php @@ -129,12 +129,12 @@ public function searchPages($parameters = array()) { */ public function searchSuggestions($search_string, $types = array(), $past = FALSE, $extra_parameters = array()) { - $cid = sprintf('suggestions:%s', md5($search_string . implode('|', $types) . $past)); + $cid = sprintf('suggestions:%s', md5($search_string . implode('|', $types) . $past . implode('|', $extra_parameters))); if ($cache = $this->cacheGet($cid)) { return $cache->data; } - $suggestions = $this->realSearchService->searchSuggestions($search_string, $types, $past); + $suggestions = $this->realSearchService->searchSuggestions($search_string, $types, $past, $extra_parameters); $this->cacheSet($cid, $suggestions, REQUEST_TIME + CULTUREFEED_SEARCH_CACHE_EXPIRES); return $suggestions; From 5923131332a632320fb2e383478716dcd2a9d483 Mon Sep 17 00:00:00 2001 From: Dietrich Moerman Date: Fri, 27 Mar 2015 13:54:44 +0100 Subject: [PATCH 058/275] UIT-38: Use Between and And input fields for date facet. --- .../culturefeed_search_ui.module | 8 ++-- culturefeed_search_ui/includes/blocks.inc | 41 ++++++++++--------- .../lib/Drupal/CultureFeedSearchPage.php | 27 ++++-------- culturefeed_search_ui/theme/theme.inc | 4 +- 4 files changed, 37 insertions(+), 43 deletions(-) diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module index a5962c5a..6b6fce8a 100644 --- a/culturefeed_search_ui/culturefeed_search_ui.module +++ b/culturefeed_search_ui/culturefeed_search_ui.module @@ -967,13 +967,15 @@ function culturefeed_search_ui_culturefeed_search_ui_active_filters($culturefeed } // Check if user is filtering on date range. - if (!empty($query['date_range'])) { + if (!empty($query['date_from']) && !empty($query['date_to']) + && DateTime::createFromFormat('d/m/Y', $query['date_from']) + && DateTime::createFromFormat('d/m/Y', $query['date_to'])) { $search_query = $query; - unset($search_query['date_range']); + unset($search_query['date_from'], $search_query['date_to']); $url = url($path, array('query' => $search_query)); $build['date_search'] = array( '#theme' => 'culturefeed_search_active_filters_item', - '#label' => $query['date_range'], + '#label' => $query['date_from'] . ' - ' . $query['date_to'], '#url' => $url ); } diff --git a/culturefeed_search_ui/includes/blocks.inc b/culturefeed_search_ui/includes/blocks.inc index d4f9395c..bbffcafd 100644 --- a/culturefeed_search_ui/includes/blocks.inc +++ b/culturefeed_search_ui/includes/blocks.inc @@ -212,13 +212,21 @@ function culturefeed_search_ui_date_facet_form() { $form['#attributes']['class'][] = 'append-button'; - $form['date_range'] = array( + $form['date_from'] = array( '#type' => 'textfield', '#size' => 28, - '#title' => t('Choose a date'), + '#title' => t('Between'), '#title_display' => 'invisible', - '#default_value' => isset($_GET['date_range']) ? $_GET['date_range'] : '', - '#attributes' => array('placeholder' => t('Or choose a custom date'), 'autocomplete' => 'off'), + '#default_value' => isset($_GET['date_from']) ? $_GET['date_from'] : '', + '#attributes' => array('placeholder' => t('Between'), 'autocomplete' => 'off'), + ); + $form['date_to'] = array( + '#type' => 'textfield', + '#size' => 28, + '#title' => t('And'), + '#title_display' => 'invisible', + '#default_value' => isset($_GET['date_to']) ? $_GET['date_to'] : '', + '#attributes' => array('placeholder' => t('And'), 'autocomplete' => 'off'), ); $form['submit'] = array( @@ -238,21 +246,14 @@ function culturefeed_search_ui_date_facet_form() { */ function culturefeed_search_ui_date_facet_form_validate($form, &$form_state) { - if (!empty($form_state['values']['date_range'])) { - - $form_state['values']['date_range'] = str_replace(t('till'), '-', $form_state['values']['date_range']); - $dates = explode('-', $form_state['values']['date_range']); - $startDate = DateTime::createFromFormat('d/m/Y', trim($dates[0])); - if (!$startDate) { - form_set_error('date_range', t('Please enter a valid date')); - } - elseif (isset($dates[1])) { - $endDate = DateTime::createFromFormat('d/m/Y', trim($dates[1])); - if (!$endDate) { - form_set_error('date_range', t('Please enter a valid date')); - } + $error = FALSE; + foreach (array('date_from', 'date_to') as $key) { + if (!empty($form_state['values'][$key]) && !DateTime::createFromFormat('d/m/Y', $form_state['values'][$key])) { + form_set_error($key, !$error ? t('Please enter a valid date') : ''); + $error = TRUE; } } + } /** @@ -267,8 +268,10 @@ function culturefeed_search_ui_date_facet_form_submit($form, &$form_state) { unset($query['facet']); } - if (!empty($form_state['values']['date_range'])) { - $query['date_range'] = $form_state['values']['date_range']; + foreach (array('date_from', 'date_to') as $key) { + if (!empty($form_state['values'][$key])) { + $query[$key] = $form_state['values'][$key]; + } } $form_state['redirect'] = array( diff --git a/culturefeed_search_ui/lib/Drupal/CultureFeedSearchPage.php b/culturefeed_search_ui/lib/Drupal/CultureFeedSearchPage.php index 9d32ff59..1d2959bc 100644 --- a/culturefeed_search_ui/lib/Drupal/CultureFeedSearchPage.php +++ b/culturefeed_search_ui/lib/Drupal/CultureFeedSearchPage.php @@ -398,27 +398,16 @@ public function loadPage() { protected function addFacetFilters($params) { // Add the date range facet. - if (isset($params['date_range'])) { - - $dates = explode('-', $params['date_range']); - $startDate = DateTime::createFromFormat('d/m/Y', trim($dates[0])); - if ($startDate) { - $endDate = clone $startDate; - if (isset($dates[1])) { - $endDateTime = DateTime::createFromFormat('d/m/Y', trim($dates[1])); - if ($endDateTime) { - $endDate = $endDateTime; - } - } + if (!empty($params['date_from']) && !empty($params['date_to']) + && ($startDate = DateTime::createFromFormat('d/m/Y', $params['date_from'])) + && ($endDate = DateTime::createFromFormat('d/m/Y', $params['date_to']))) { + // Set start date time on beginning of the day. + $startDate->setTime(0, 0, 1); - // Set start date time on beginning of the day. - $startDate->setTime(0, 0, 1); + // Set end date time to end of the day day, to it searches on full day. + $endDate->setTime(23, 59, 59); - // Set end date time to end of the day day, to it searches on full day. - $endDate->setTime(23, 59, 59); - - $this->parameters[] = new Parameter\DateRangeFilterQuery('startdate', $startDate->getTimestamp(), $endDate->getTimestamp()); - } + $this->parameters[] = new Parameter\DateRangeFilterQuery('startdate', $startDate->getTimestamp(), $endDate->getTimestamp()); } // Add search on coordinates. diff --git a/culturefeed_search_ui/theme/theme.inc b/culturefeed_search_ui/theme/theme.inc index 6bf3da4e..6cb93a35 100644 --- a/culturefeed_search_ui/theme/theme.inc +++ b/culturefeed_search_ui/theme/theme.inc @@ -406,8 +406,8 @@ function culturefeed_search_ui_preprocess_culturefeed_search_facet_item(&$variab } // When the facet is datetype, we don't want to keep a date range filter.. - if ($facet_key == 'datetype' && isset($query['date_range'])) { - unset($query['date_range']); + if ($facet_key == 'datetype') { + unset($query['date_from'], $query['date_to']); } // Agefrom facet is active when min_age is given. From 9895d3db53c5e586122affb41fe909899d3188f5 Mon Sep 17 00:00:00 2001 From: Dietrich Moerman Date: Sat, 28 Mar 2015 23:23:33 +0100 Subject: [PATCH 059/275] UIT-38: Install Date Range Picker for selecting ranges; use for date search facet. --- .../css/daterangepicker-bs2.css | 287 ++++ .../css/daterangepicker-bs3.css | 319 ++++ .../css/ui.daterangepicker.css | 104 -- .../culturefeed_search_ui.module | 24 +- culturefeed_search_ui/includes/blocks.inc | 9 +- .../js/daterangepicker.jQuery.compressed.js | 1 - culturefeed_search_ui/js/daterangepicker.js | 1280 +++++++++++++++++ culturefeed_search_ui/js/moment.min.js | 7 + culturefeed_search_ui/js/search_ui.js | 76 +- 9 files changed, 1979 insertions(+), 128 deletions(-) create mode 100644 culturefeed_search_ui/css/daterangepicker-bs2.css create mode 100644 culturefeed_search_ui/css/daterangepicker-bs3.css delete mode 100755 culturefeed_search_ui/css/ui.daterangepicker.css delete mode 100644 culturefeed_search_ui/js/daterangepicker.jQuery.compressed.js create mode 100644 culturefeed_search_ui/js/daterangepicker.js create mode 100644 culturefeed_search_ui/js/moment.min.js diff --git a/culturefeed_search_ui/css/daterangepicker-bs2.css b/culturefeed_search_ui/css/daterangepicker-bs2.css new file mode 100644 index 00000000..e222688a --- /dev/null +++ b/culturefeed_search_ui/css/daterangepicker-bs2.css @@ -0,0 +1,287 @@ +/*! + * Stylesheet for the Date Range Picker, for use with Bootstrap 2.x + * + * Copyright 2013-2015 Dan Grossman ( http://www.dangrossman.info ) + * Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php + * + * Built for http://www.improvely.com + */ + +.daterangepicker.dropdown-menu { + max-width: none; + z-index: 3000; +} + +.daterangepicker.opensleft .ranges, .daterangepicker.opensleft .calendar { + float: left; + margin: 4px; +} + +.daterangepicker.opensright .ranges, .daterangepicker.opensright .calendar, +.daterangepicker.openscenter .ranges, .daterangepicker.openscenter .calendar { + float: right; + margin: 4px; +} + +.daterangepicker .ranges { + width: 160px; + text-align: left; +} + +.daterangepicker .ranges .range_inputs>div { + float: left; +} + +.daterangepicker .ranges .range_inputs>div:nth-child(2) { + padding-left: 11px; +} + +.daterangepicker .calendar { + display: none; + max-width: 250px; +} +.daterangepicker.show-calendar .calendar { + display: block; +} + +.daterangepicker .calendar.single .calendar-date { + border: none; +} + +.daterangepicker .calendar th, .daterangepicker .calendar td { + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + white-space: nowrap; + text-align: center; +} + +.daterangepicker .daterangepicker_start_input label, +.daterangepicker .daterangepicker_end_input label { + color: #333; + font-size: 11px; + margin-bottom: 2px; + text-transform: uppercase; + text-shadow: 1px 1px 0 #fff; +} + +.daterangepicker .ranges input { + font-size: 11px; +} + +.daterangepicker .ranges ul { + list-style: none; + margin: 0; + padding: 0; +} + +.daterangepicker .ranges li { + font-size: 13px; + background: #f5f5f5; + border: 1px solid #f5f5f5; + color: #08c; + padding: 3px 12px; + margin-bottom: 8px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + cursor: pointer; +} + +.daterangepicker .ranges li.active, .daterangepicker .ranges li:hover { + background: #08c; + border: 1px solid #08c; + color: #fff; +} + +.daterangepicker .calendar-date { + border: 1px solid #ddd; + padding: 4px; + border-radius: 4px; + background: #fff; +} + +.daterangepicker .calendar-time { + text-align: center; + margin: 8px auto 0 auto; + line-height: 30px; +} + +.daterangepicker { + position: absolute; + background: #fff; + top: 100px; + left: 20px; + padding: 4px; + margin-top: 1px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.daterangepicker.opensleft:before { + position: absolute; + top: -7px; + right: 9px; + display: inline-block; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-left: 7px solid transparent; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; +} + +.daterangepicker.opensleft:after { + position: absolute; + top: -6px; + right: 10px; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + border-left: 6px solid transparent; + content: ''; +} + +.daterangepicker.openscenter:before { + position: absolute; + top: -7px; + left: 0; + right: 0; + width: 0; + margin-left: auto; + margin-right: auto; + display: inline-block; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-left: 7px solid transparent; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; +} + +.daterangepicker.openscenter:after { + position: absolute; + top: -6px; + left: 0; + right: 0; + width: 0; + margin-left: auto; + margin-right: auto; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + border-left: 6px solid transparent; + content: ''; +} + +.daterangepicker.opensright:before { + position: absolute; + top: -7px; + left: 9px; + display: inline-block; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-left: 7px solid transparent; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; +} + +.daterangepicker.opensright:after { + position: absolute; + top: -6px; + left: 10px; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + border-left: 6px solid transparent; + content: ''; +} + +.daterangepicker table { + width: 100%; + margin: 0; +} + +.daterangepicker td, .daterangepicker th { + text-align: center; + width: 20px; + height: 20px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + cursor: pointer; + white-space: nowrap; +} + +.daterangepicker td.off { + color: #999; +} + +.daterangepicker td.disabled, .daterangepicker option.disabled { + color: #999; +} + +.daterangepicker td.available:hover, .daterangepicker th.available:hover { + background: #eee; +} + +.daterangepicker td.in-range { + background: #ebf4f8; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.daterangepicker td.active, .daterangepicker td.active:hover { + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #0088cc, #0044cc); + background-image: -ms-linear-gradient(top, #0088cc, #0044cc); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); + background-image: -o-linear-gradient(top, #0088cc, #0044cc); + background-image: linear-gradient(top, #0088cc, #0044cc); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); + border-color: #0044cc #0044cc #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + color: #fff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} + +.daterangepicker td.week, .daterangepicker th.week { + font-size: 80%; + color: #ccc; +} + +.daterangepicker select.monthselect, .daterangepicker select.yearselect { + font-size: 12px; + padding: 1px; + height: auto; + margin: 0; + cursor: default; +} + +.daterangepicker select.monthselect { + margin-right: 2%; + width: 56%; +} + +.daterangepicker select.yearselect { + width: 40%; +} + +.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect { + width: 60px; + margin-bottom: 0; +} + +.daterangepicker_start_input { + float: left; +} + +.daterangepicker_end_input { + float: left; + padding-left: 11px +} + +.daterangepicker th.month { + width: auto; +} diff --git a/culturefeed_search_ui/css/daterangepicker-bs3.css b/culturefeed_search_ui/css/daterangepicker-bs3.css new file mode 100644 index 00000000..c9c8fedf --- /dev/null +++ b/culturefeed_search_ui/css/daterangepicker-bs3.css @@ -0,0 +1,319 @@ +/*! + * Stylesheet for the Date Range Picker, for use with Bootstrap 3.x + * + * Copyright 2013-2015 Dan Grossman ( http://www.dangrossman.info ) + * Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php + * + * Built for http://www.improvely.com + */ + + .daterangepicker.dropdown-menu { + max-width: none; + z-index: 3000; +} + +.daterangepicker.opensleft .ranges, .daterangepicker.opensleft .calendar { + float: left; + margin: 4px; +} + +.daterangepicker.opensright .ranges, .daterangepicker.opensright .calendar, +.daterangepicker.openscenter .ranges, .daterangepicker.openscenter .calendar { + float: right; + margin: 4px; +} + +.daterangepicker.single .ranges, .daterangepicker.single .calendar { + float: none; +} + +.daterangepicker .ranges { + width: 160px; + text-align: left; +} + +.daterangepicker .ranges .range_inputs>div { + float: left; +} + +.daterangepicker .ranges .range_inputs>div:nth-child(2) { + padding-left: 11px; +} + +.daterangepicker .calendar { + display: none; + max-width: 270px; +} + +.daterangepicker.show-calendar .calendar { + display: block; +} + +.daterangepicker .calendar.single .calendar-date { + border: none; +} + +.daterangepicker .calendar th, .daterangepicker .calendar td { + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + white-space: nowrap; + text-align: center; + min-width: 32px; +} + +.daterangepicker .daterangepicker_start_input label, +.daterangepicker .daterangepicker_end_input label { + color: #333; + display: block; + font-size: 11px; + font-weight: normal; + height: 20px; + line-height: 20px; + margin-bottom: 2px; + text-shadow: #fff 1px 1px 0px; + text-transform: uppercase; + width: 74px; +} + +.daterangepicker .ranges input { + font-size: 11px; +} + +.daterangepicker .ranges .input-mini { + border: 1px solid #ccc; + border-radius: 4px; + color: #555; + display: block; + font-size: 11px; + height: 30px; + line-height: 30px; + vertical-align: middle; + margin: 0 0 10px 0; + padding: 0 6px; + width: 74px; +} + +.daterangepicker .ranges ul { + list-style: none; + margin: 0; + padding: 0; +} + +.daterangepicker .ranges li { + font-size: 13px; + background: #f5f5f5; + border: 1px solid #f5f5f5; + color: #08c; + padding: 3px 12px; + margin-bottom: 8px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + cursor: pointer; +} + +.daterangepicker .ranges li.active, .daterangepicker .ranges li:hover { + background: #08c; + border: 1px solid #08c; + color: #fff; +} + +.daterangepicker .calendar-date { + border: 1px solid #ddd; + padding: 4px; + border-radius: 4px; + background: #fff; +} + +.daterangepicker .calendar-time { + text-align: center; + margin: 8px auto 0 auto; + line-height: 30px; +} + +.daterangepicker { + position: absolute; + background: #fff; + top: 100px; + left: 20px; + padding: 4px; + margin-top: 1px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.daterangepicker.opensleft:before { + position: absolute; + top: -7px; + right: 9px; + display: inline-block; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-left: 7px solid transparent; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; +} + +.daterangepicker.opensleft:after { + position: absolute; + top: -6px; + right: 10px; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + border-left: 6px solid transparent; + content: ''; +} + +.daterangepicker.openscenter:before { + position: absolute; + top: -7px; + left: 0; + right: 0; + width: 0; + margin-left: auto; + margin-right: auto; + display: inline-block; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-left: 7px solid transparent; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; +} + +.daterangepicker.openscenter:after { + position: absolute; + top: -6px; + left: 0; + right: 0; + width: 0; + margin-left: auto; + margin-right: auto; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + border-left: 6px solid transparent; + content: ''; +} + +.daterangepicker.opensright:before { + position: absolute; + top: -7px; + left: 9px; + display: inline-block; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-left: 7px solid transparent; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; +} + +.daterangepicker.opensright:after { + position: absolute; + top: -6px; + left: 10px; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid #fff; + border-left: 6px solid transparent; + content: ''; +} + +.daterangepicker table { + width: 100%; + margin: 0; +} + +.daterangepicker td, .daterangepicker th { + text-align: center; + width: 20px; + height: 20px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + cursor: pointer; + white-space: nowrap; +} + +.daterangepicker td.off { + color: #999; +} + +.daterangepicker td.disabled, .daterangepicker option.disabled { + color: #999; +} + +.daterangepicker td.available:hover, .daterangepicker th.available:hover { + background: #eee; +} + +.daterangepicker td.in-range { + background: #ebf4f8; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.daterangepicker td.start-date { + -webkit-border-radius: 4px 0 0 4px; + -moz-border-radius: 4px 0 0 4px; + border-radius: 4px 0 0 4px; +} + +.daterangepicker td.end-date { + -webkit-border-radius: 0 4px 4px 0; + -moz-border-radius: 0 4px 4px 0; + border-radius: 0 4px 4px 0; +} + +.daterangepicker td.start-date.end-date { + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.daterangepicker td.active, .daterangepicker td.active:hover { + background-color: #357ebd; + border-color: #3071a9; + color: #fff; +} + +.daterangepicker td.week, .daterangepicker th.week { + font-size: 80%; + color: #ccc; +} + +.daterangepicker select.monthselect, .daterangepicker select.yearselect { + font-size: 12px; + padding: 1px; + height: auto; + margin: 0; + cursor: default; +} + +.daterangepicker select.monthselect { + margin-right: 2%; + width: 56%; +} + +.daterangepicker select.yearselect { + width: 40%; +} + +.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect { + width: 50px; + margin-bottom: 0; +} + +.daterangepicker_start_input { + float: left; +} + +.daterangepicker_end_input { + float: left; + padding-left: 11px +} + +.daterangepicker th.month { + width: auto; +} diff --git a/culturefeed_search_ui/css/ui.daterangepicker.css b/culturefeed_search_ui/css/ui.daterangepicker.css deleted file mode 100755 index 18d40806..00000000 --- a/culturefeed_search_ui/css/ui.daterangepicker.css +++ /dev/null @@ -1,104 +0,0 @@ -/*styles for jquery ui daterangepicker plugin */ - -.ui-daterangepickercontain { - z-index: 999; -} -.ui-daterangepickercontain .ui-daterangepicker { - float: left; - padding: 5px !important; - width: auto; - display: inline; - background-image: none !important; - clear: left; - position: absolute; - z-index: 9999; -} -.ui-daterangepicker ul, .ui-daterangepicker .ranges, .ui-daterangepicker .range-start, .ui-daterangepicker .range-end { - float: left; - padding: 0; - margin: 0; -} -.ui-daterangepicker .ranges { - width: auto; - position: relative; - padding: 5px 5px 40px 0; - margin-left: 10px; -} -.ui-daterangepicker .range-start, .ui-daterangepicker .range-end { - margin-left: 5px; -} -.ui-daterangepicker button.btnDone { - margin: 0 5px 5px 0; - position: absolute; - bottom: 0; - right: 0; - clear: both; - cursor: pointer; - font-size: 1.1em; -} -.ui-daterangepicker ul { - width: 17.6em; - background: none; - border: 0; -} -.ui-daterangepicker li { - list-style: none; - padding: 1px; - cursor: pointer; - margin: 1px 0; -} -.ui-daterangepicker li.ui-state-hover, .ui-daterangepicker li.ui-state-active { - padding: 0; -} -.ui-daterangepicker li.preset_0 { - margin-top: 1.5em !important; -} -.ui-daterangepicker .ui-widget-content a { - text-decoration: none !important; -} -.ui-daterangepicker li a { - font-weight: normal; - margin: .3em .5em; - display: block; -} -.ui-daterangepicker li span { - float: right; - margin: .3em .2em; -} -.ui-daterangepicker .title-start, .ui-daterangepicker .title-end { - display: block; - margin: 0 0 .2em; - font-size: 1em; - padding: 0 4px 2px; -} -.ui-daterangepicker .ui-datepicker-inline { - font-size: 1em; -} -.ui-daterangepicker-arrows { - padding: 2px; - width: 204px; - position: relative; -} -.ui-daterangepicker-arrows input.ui-rangepicker-input { - width: 158px; - margin: 0 2px 0 20px; - padding: 2px; - height: 1.1em; -} -.ui-daterangepicker-arrows .ui-daterangepicker-prev, .ui-daterangepicker-arrows .ui-daterangepicker-next { - position: absolute; - top: 2px; - padding: 1px; -} -.ui-daterangepicker-arrows .ui-daterangepicker-prev { - left: 2px; -} -.ui-daterangepicker-arrows .ui-daterangepicker-next { - right: 2px; -} -.ui-daterangepicker-arrows .ui-daterangepicker-prev:hover, -.ui-daterangepicker-arrows .ui-daterangepicker-next:hover, -.ui-daterangepicker-arrows .ui-daterangepicker-prev:focus, -.ui-daterangepicker-arrows .ui-daterangepicker-next:focus { - padding: 0; -} diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module index 6b6fce8a..1573b665 100644 --- a/culturefeed_search_ui/culturefeed_search_ui.module +++ b/culturefeed_search_ui/culturefeed_search_ui.module @@ -325,19 +325,29 @@ function culturefeed_search_ui_library() { $path = drupal_get_path('module', 'culturefeed_search_ui'); - // Date range picker + // Moment.js: Parse, validate, manipulate, and display dates in JavaScript. + $libraries['ui.moment'] = array( + 'title' => 'Moment.js', + 'website' => 'http://momentjs.com/', + 'version' => '2.9.0', + 'js' => array( + $path . '/js/moment.min.js' => array(), + ), + ); + + // Date Range Picker: A JavaScript widget for choosing date ranges. $libraries['ui.daterangepicker'] = array( - 'title' => 'Datejs', - 'website' => 'http://filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/', - 'version' => '1', + 'title' => 'Date Range Picker', + 'website' => 'http://www.daterangepicker.com/', + 'version' => '1.3.19+master', 'js' => array( - $path . '/js/daterangepicker.jQuery.compressed.js' => array(), + $path . '/js/daterangepicker.js' => array(), ), 'css' => array( - $path . '/css/ui.daterangepicker.css' => array(), + $path . '/css/daterangepicker-bs3.css' => array(), ), 'dependencies' => array( - array('system', 'ui.datepicker'), + array('culturefeed_search_ui', 'ui.moment'), ), ); diff --git a/culturefeed_search_ui/includes/blocks.inc b/culturefeed_search_ui/includes/blocks.inc index bbffcafd..eea8f9d9 100644 --- a/culturefeed_search_ui/includes/blocks.inc +++ b/culturefeed_search_ui/includes/blocks.inc @@ -228,10 +228,17 @@ function culturefeed_search_ui_date_facet_form() { '#default_value' => isset($_GET['date_to']) ? $_GET['date_to'] : '', '#attributes' => array('placeholder' => t('And'), 'autocomplete' => 'off'), ); - + $form['date_range'] = array( + '#markup' => l('' . t('Specific dates') . '', 'javascript:', array( + 'html' => TRUE, + 'external' => TRUE, + 'attributes' => array('id' => 'specific-dates-range'), + )), + ); $form['submit'] = array( '#type' => 'submit', '#value' => t('Ok'), + '#attributes' => array('id' => 'submit-specific-dates'), ); $form['#attached']['library'][] = array('culturefeed_search_ui', 'ui.daterangepicker'); diff --git a/culturefeed_search_ui/js/daterangepicker.jQuery.compressed.js b/culturefeed_search_ui/js/daterangepicker.jQuery.compressed.js deleted file mode 100644 index caa48ea2..00000000 --- a/culturefeed_search_ui/js/daterangepicker.jQuery.compressed.js +++ /dev/null @@ -1 +0,0 @@ -(function(a){a.fn.daterangepicker=function(s){var d=a(this);var e=a.extend({presetRanges:[{text:"Today",dateStart:"today",dateEnd:"today"},{text:"Last 7 days",dateStart:"today-7days",dateEnd:"today"},{text:"Month to date",dateStart:function(){return Date.parse("today").moveToFirstDayOfMonth()},dateEnd:"today"},{text:"Year to date",dateStart:function(){var w=Date.parse("today");w.setMonth(0);w.setDate(1);return w},dateEnd:"today"},{text:"The previous Month",dateStart:function(){return Date.parse("1 month ago").moveToFirstDayOfMonth()},dateEnd:function(){return Date.parse("1 month ago").moveToLastDayOfMonth()}}],presets:{specificDate:"Specific Date",allDatesBefore:"All Dates Before",allDatesAfter:"All Dates After",dateRange:"Date Range"},rangeStartTitle:"Start date",rangeEndTitle:"End date",nextLinkText:"Next",prevLinkText:"Prev",target:d,doneButtonText:"Done",earliestDate:Date.parse("-15years"),latestDate:Date.parse("+15years"),constrainDates:false,rangeSplitter:"-",dateFormat:"m/d/yy",closeOnSelect:true,arrows:false,appendTo:"body",onClose:function(){},onOpen:function(){},onChange:function(){},datepickerOptions:null},s);var g={onSelect:function(A,z){var y=j.find(".range-start");var B=j.find(".range-end");if(j.find(".ui-daterangepicker-specificDate").is(".ui-state-active")){B.datepicker("setDate",y.datepicker("getDate"))}a(this).trigger("constrainOtherPicker");var x=b(y.datepicker("getDate"));var w=b(B.datepicker("getDate"));if(d.length==2){d.eq(0).val(x);d.eq(1).val(w)}else{d.val((x!=w)?x+" "+e.rangeSplitter+" "+w:x)}if(e.closeOnSelect){if(!j.find("li.ui-state-active").is(".ui-daterangepicker-dateRange")&&!j.is(":animated")){k()}a(this).trigger("constrainOtherPicker");e.onChange()}},defaultDate:+0};d.bind("change",e.onChange);e.datepickerOptions=(s)?a.extend(g,s.datepickerOptions):g;var m,l=Date.parse("today");var o,i;if(d.size()==2){o=Date.parse(d.eq(0).val());i=Date.parse(d.eq(1).val());if(o==null){o=i}if(i==null){i=o}}else{o=Date.parse(d.val().split(e.rangeSplitter)[0]);i=Date.parse(d.val().split(e.rangeSplitter)[1]);if(i==null){i=o}}if(o!=null){m=o}if(i!=null){l=i}var j=a('
        ');var u=(function(){var y=a('
          ').appendTo(j);a.each(e.presetRanges,function(){a('
        • '+this.text+"
        • ").data("dateStart",this.dateStart).data("dateEnd",this.dateEnd).appendTo(y)});var w=0;a.each(e.presets,function(x,z){a('
        • '+z+"
        • ").appendTo(y);w++});y.find("li").hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).click(function(){j.find(".ui-state-active").removeClass("ui-state-active");a(this).addClass("ui-state-active");q(a(this),j,n,f);return false});return y})();function b(y){if(!y.getDate()){return""}var x=y.getDate();var A=y.getMonth();var z=y.getFullYear();A++;var w=e.dateFormat;return a.datepicker.formatDate(w,y)}a.fn.restoreDateFromData=function(){if(a(this).data("saveDate")){a(this).datepicker("setDate",a(this).data("saveDate")).removeData("saveDate")}return this};a.fn.saveDateToData=function(){if(!a(this).data("saveDate")){a(this).data("saveDate",a(this).datepicker("getDate"))}return this};function t(){if(j.data("state")=="closed"){v();j.fadeIn(300).data("state","open");e.onOpen()}}function k(){if(j.data("state")=="open"){j.fadeOut(300).data("state","closed");e.onClose()}}function c(){if(j.data("state")=="open"){k()}else{t()}}function v(){var w=p||d;var A=w.offset(),y="left",z=A.left,x=a(window).width()-z-w.outerWidth();if(z>x){y="right",z=x}j.parent().css(y,z).css("top",A.top+w.outerHeight())}function q(z,y,A,w){if(z.is(".ui-daterangepicker-specificDate")){w.hide();A.show();y.find(".title-start").text(e.presets.specificDate);y.find(".range-start").restoreDateFromData().css("opacity",1).show(400);y.find(".range-end").restoreDateFromData().css("opacity",0).hide(400);setTimeout(function(){w.fadeIn()},400)}else{if(z.is(".ui-daterangepicker-allDatesBefore")){w.hide();A.show();y.find(".title-end").text(e.presets.allDatesBefore);y.find(".range-start").saveDateToData().datepicker("setDate",e.earliestDate).css("opacity",0).hide(400);y.find(".range-end").restoreDateFromData().css("opacity",1).show(400);setTimeout(function(){w.fadeIn()},400)}else{if(z.is(".ui-daterangepicker-allDatesAfter")){w.hide();A.show();y.find(".title-start").text(e.presets.allDatesAfter);y.find(".range-start").restoreDateFromData().css("opacity",1).show(400);y.find(".range-end").saveDateToData().datepicker("setDate",e.latestDate).css("opacity",0).hide(400);setTimeout(function(){w.fadeIn()},400)}else{if(z.is(".ui-daterangepicker-dateRange")){w.hide();A.show();y.find(".title-start").text(e.rangeStartTitle);y.find(".title-end").text(e.rangeEndTitle);y.find(".range-start").restoreDateFromData().css("opacity",1).show(400);y.find(".range-end").restoreDateFromData().css("opacity",1).show(400);setTimeout(function(){w.fadeIn()},400)}else{w.hide();y.find(".range-start, .range-end").css("opacity",0).hide(400,function(){A.hide()});var B=(typeof z.data("dateStart")=="string")?Date.parse(z.data("dateStart")):z.data("dateStart")();var x=(typeof z.data("dateEnd")=="string")?Date.parse(z.data("dateEnd")):z.data("dateEnd")();y.find(".range-start").datepicker("setDate",B).find(".ui-datepicker-current-day").trigger("click");y.find(".range-end").datepicker("setDate",x).find(".ui-datepicker-current-day").trigger("click")}}}}return false}var n=a('
          Start Date
          End Date
          ').appendTo(j);n.find(".range-start, .range-end").datepicker(e.datepickerOptions);n.find(".range-start").datepicker("setDate",m);n.find(".range-end").datepicker("setDate",l);n.find(".range-start, .range-end").bind("constrainOtherPicker",function(){if(e.constrainDates){if(a(this).is(".range-start")){j.find(".range-end").datepicker("option","minDate",a(this).datepicker("getDate"))}else{j.find(".range-start").datepicker("option","maxDate",a(this).datepicker("getDate"))}}}).trigger("constrainOtherPicker");var f=a('").click(function(){j.find(".ui-datepicker-current-day").trigger("click");k()}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")}).appendTo(n);a(this).click(function(){c();return false});n.hide().find(".range-start, .range-end, .btnDone").hide();j.data("state","closed");n.find(".ui-datepicker").css("display","block");a(e.appendTo).append(j);j.wrap('
          ');if(e.arrows&&d.size()==1){var h=a(''+e.prevLinkText+"");var r=a(''+e.nextLinkText+"");a(this).addClass("ui-rangepicker-input ui-widget-content").wrap('
          ').before(h).before(r).parent().find("a").click(function(){var x=n.find(".range-start").datepicker("getDate");var w=n.find(".range-end").datepicker("getDate");var y=Math.abs(new TimeSpan(x-w).getTotalMilliseconds())+86400000;if(a(this).is(".ui-daterangepicker-prev")){y=-y}n.find(".range-start, .range-end ").each(function(){var z=a(this).datepicker("getDate");if(z==null){return false}a(this).datepicker("setDate",z.add({milliseconds:y})).find(".ui-datepicker-current-day").trigger("click")});return false}).hover(function(){a(this).addClass("ui-state-hover")},function(){a(this).removeClass("ui-state-hover")});var p=d.parent()}a(document).click(function(){if(j.is(":visible")){k()}});j.click(function(){return false}).hide();return this}})(jQuery); \ No newline at end of file diff --git a/culturefeed_search_ui/js/daterangepicker.js b/culturefeed_search_ui/js/daterangepicker.js new file mode 100644 index 00000000..dae63e68 --- /dev/null +++ b/culturefeed_search_ui/js/daterangepicker.js @@ -0,0 +1,1280 @@ +/** +* @version: 1.3.19 +* @author: Dan Grossman http://www.dangrossman.info/ +* @copyright: Copyright (c) 2012-2015 Dan Grossman. All rights reserved. +* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php +* @website: https://www.improvely.com/ +*/ + +(function(root, factory) { + + if (typeof define === 'function' && define.amd) { + define(['moment', 'jquery', 'exports'], function(momentjs, $, exports) { + root.daterangepicker = factory(root, exports, momentjs, $); + }); + + } else if (typeof exports !== 'undefined') { + var momentjs = require('moment'); + var jQuery; + try { + jQuery = require('jquery'); + } catch (err) { + jQuery = window.jQuery; + if (!jQuery) throw new Error('jQuery dependency not found'); + } + + factory(root, exports, momentjs, jQuery); + + // Finally, as a browser global. + } else { + root.daterangepicker = factory(root, {}, root.moment, (root.jQuery || root.Zepto || root.ender || root.$)); + } + +}(this, function(root, daterangepicker, moment, $) { + + var DateRangePicker = function (element, options, cb) { + + // by default, the daterangepicker element is placed at the bottom of HTML body + this.parentEl = 'body'; + + //element that triggered the date range picker + this.element = $(element); + + //tracks visible state + this.isShowing = false; + + //create the picker HTML object + var DRPTemplate = ''; + + //custom options + if (typeof options !== 'object' || options === null) + options = {}; + + this.parentEl = (typeof options === 'object' && options.parentEl && $(options.parentEl).length) ? $(options.parentEl) : $(this.parentEl); + this.container = $(DRPTemplate).appendTo(this.parentEl); + + this.setOptions(options, cb); + + //apply CSS classes and labels to buttons + var c = this.container; + $.each(this.buttonClasses, function (idx, val) { + c.find('button').addClass(val); + }); + this.container.find('.daterangepicker_start_input label').html(this.locale.fromLabel); + this.container.find('.daterangepicker_end_input label').html(this.locale.toLabel); + if (this.applyClass.length) + this.container.find('.applyBtn').addClass(this.applyClass); + if (this.cancelClass.length) + this.container.find('.cancelBtn').addClass(this.cancelClass); + this.container.find('.applyBtn').html(this.locale.applyLabel); + this.container.find('.cancelBtn').html(this.locale.cancelLabel); + + //event listeners + + this.container.find('.calendar') + .on('click.daterangepicker', '.prev', $.proxy(this.clickPrev, this)) + .on('click.daterangepicker', '.next', $.proxy(this.clickNext, this)) + .on('click.daterangepicker', 'td.available', $.proxy(this.clickDate, this)) + .on('mouseenter.daterangepicker', 'td.available', $.proxy(this.hoverDate, this)) + .on('mouseleave.daterangepicker', 'td.available', $.proxy(this.updateFormInputs, this)) + .on('change.daterangepicker', 'select.yearselect', $.proxy(this.updateMonthYear, this)) + .on('change.daterangepicker', 'select.monthselect', $.proxy(this.updateMonthYear, this)) + .on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.updateTime, this)); + + this.container.find('.ranges') + .on('click.daterangepicker', 'button.applyBtn', $.proxy(this.clickApply, this)) + .on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this)) + .on('click.daterangepicker', '.daterangepicker_start_input,.daterangepicker_end_input', $.proxy(this.showCalendars, this)) + .on('change.daterangepicker', '.daterangepicker_start_input,.daterangepicker_end_input', $.proxy(this.inputsChanged, this)) + .on('keydown.daterangepicker', '.daterangepicker_start_input,.daterangepicker_end_input', $.proxy(this.inputsKeydown, this)) + .on('click.daterangepicker', 'li', $.proxy(this.clickRange, this)) + .on('mouseenter.daterangepicker', 'li', $.proxy(this.enterRange, this)) + .on('mouseleave.daterangepicker', 'li', $.proxy(this.updateFormInputs, this)); + + if (this.element.is('input')) { + this.element.on({ + 'click.daterangepicker': $.proxy(this.show, this), + 'focus.daterangepicker': $.proxy(this.show, this), + 'keyup.daterangepicker': $.proxy(this.updateFromControl, this) + }); + } else { + this.element.on('click.daterangepicker', $.proxy(this.toggle, this)); + } + + }; + + DateRangePicker.prototype = { + + constructor: DateRangePicker, + + setOptions: function(options, callback) { + + this.startDate = moment().startOf('day'); + this.endDate = moment().endOf('day'); + this.timeZone = moment().utcOffset(); + this.minDate = false; + this.maxDate = false; + this.dateLimit = false; + + this.showDropdowns = false; + this.showWeekNumbers = false; + this.timePicker = false; + this.timePickerSeconds = false; + this.timePickerIncrement = 30; + this.timePicker12Hour = true; + this.singleDatePicker = false; + this.ranges = {}; + + this.opens = 'right'; + if (this.element.hasClass('pull-right')) + this.opens = 'left'; + + this.buttonClasses = ['btn', 'btn-small btn-sm']; + this.applyClass = 'btn-success'; + this.cancelClass = 'btn-default'; + + this.format = 'MM/DD/YYYY'; + this.separator = ' - '; + + this.locale = { + applyLabel: 'Apply', + cancelLabel: 'Cancel', + fromLabel: 'From', + toLabel: 'To', + weekLabel: 'W', + customRangeLabel: 'Custom Range', + daysOfWeek: moment.weekdaysMin(), + monthNames: moment.monthsShort(), + firstDay: moment.localeData()._week.dow + }; + + this.cb = function () { }; + + if (typeof options.format === 'string') + this.format = options.format; + + if (typeof options.separator === 'string') + this.separator = options.separator; + + if (typeof options.startDate === 'string') + this.startDate = moment(options.startDate, this.format); + + if (typeof options.endDate === 'string') + this.endDate = moment(options.endDate, this.format); + + if (typeof options.minDate === 'string') + this.minDate = moment(options.minDate, this.format); + + if (typeof options.maxDate === 'string') + this.maxDate = moment(options.maxDate, this.format); + + if (typeof options.startDate === 'object') + this.startDate = moment(options.startDate); + + if (typeof options.endDate === 'object') + this.endDate = moment(options.endDate); + + if (typeof options.minDate === 'object') + this.minDate = moment(options.minDate); + + if (typeof options.maxDate === 'object') + this.maxDate = moment(options.maxDate); + + if (typeof options.applyClass === 'string') + this.applyClass = options.applyClass; + + if (typeof options.cancelClass === 'string') + this.cancelClass = options.cancelClass; + + if (typeof options.dateLimit === 'object') + this.dateLimit = options.dateLimit; + + if (typeof options.locale === 'object') { + + if (typeof options.locale.daysOfWeek === 'object') { + // Create a copy of daysOfWeek to avoid modification of original + // options object for reusability in multiple daterangepicker instances + this.locale.daysOfWeek = options.locale.daysOfWeek.slice(); + } + + if (typeof options.locale.monthNames === 'object') { + this.locale.monthNames = options.locale.monthNames.slice(); + } + + if (typeof options.locale.firstDay === 'number') { + this.locale.firstDay = options.locale.firstDay; + } + + if (typeof options.locale.applyLabel === 'string') { + this.locale.applyLabel = options.locale.applyLabel; + } + + if (typeof options.locale.cancelLabel === 'string') { + this.locale.cancelLabel = options.locale.cancelLabel; + } + + if (typeof options.locale.fromLabel === 'string') { + this.locale.fromLabel = options.locale.fromLabel; + } + + if (typeof options.locale.toLabel === 'string') { + this.locale.toLabel = options.locale.toLabel; + } + + if (typeof options.locale.weekLabel === 'string') { + this.locale.weekLabel = options.locale.weekLabel; + } + + if (typeof options.locale.customRangeLabel === 'string') { + this.locale.customRangeLabel = options.locale.customRangeLabel; + } + } + + if (typeof options.opens === 'string') + this.opens = options.opens; + + if (typeof options.showWeekNumbers === 'boolean') { + this.showWeekNumbers = options.showWeekNumbers; + } + + if (typeof options.buttonClasses === 'string') { + this.buttonClasses = [options.buttonClasses]; + } + + if (typeof options.buttonClasses === 'object') { + this.buttonClasses = options.buttonClasses; + } + + if (typeof options.showDropdowns === 'boolean') { + this.showDropdowns = options.showDropdowns; + } + + if (typeof options.singleDatePicker === 'boolean') { + this.singleDatePicker = options.singleDatePicker; + if (this.singleDatePicker) { + this.endDate = this.startDate.clone(); + } + } + + if (typeof options.timePicker === 'boolean') { + this.timePicker = options.timePicker; + } + + if (typeof options.timePickerSeconds === 'boolean') { + this.timePickerSeconds = options.timePickerSeconds; + } + + if (typeof options.timePickerIncrement === 'number') { + this.timePickerIncrement = options.timePickerIncrement; + } + + if (typeof options.timePicker12Hour === 'boolean') { + this.timePicker12Hour = options.timePicker12Hour; + } + + // update day names order to firstDay + if (this.locale.firstDay != 0) { + var iterator = this.locale.firstDay; + while (iterator > 0) { + this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift()); + iterator--; + } + } + + var start, end, range; + + //if no start/end dates set, check if an input element contains initial values + if (typeof options.startDate === 'undefined' && typeof options.endDate === 'undefined') { + if ($(this.element).is('input[type=text]')) { + var val = $(this.element).val(), + split = val.split(this.separator); + + start = end = null; + + if (split.length == 2) { + start = moment(split[0], this.format); + end = moment(split[1], this.format); + } else if (this.singleDatePicker && val !== "") { + start = moment(val, this.format); + end = moment(val, this.format); + } + if (start !== null && end !== null) { + this.startDate = start; + this.endDate = end; + } + } + } + + // bind the time zone used to build the calendar to either the timeZone passed in through the options or the zone of the startDate (which will be the local time zone by default) + if (typeof options.timeZone === 'string' || typeof options.timeZone === 'number') { + this.timeZone = options.timeZone; + this.startDate.utcOffset(this.timeZone); + this.endDate.utcOffset(this.timeZone); + } else { + this.timeZone = moment(this.startDate).utcOffset(); + } + + if (typeof options.ranges === 'object') { + for (range in options.ranges) { + + if (typeof options.ranges[range][0] === 'string') + start = moment(options.ranges[range][0], this.format); + else + start = moment(options.ranges[range][0]); + + if (typeof options.ranges[range][1] === 'string') + end = moment(options.ranges[range][1], this.format); + else + end = moment(options.ranges[range][1]); + + // If we have a min/max date set, bound this range + // to it, but only if it would otherwise fall + // outside of the min/max. + if (this.minDate && start.isBefore(this.minDate)) + start = moment(this.minDate); + + if (this.maxDate && end.isAfter(this.maxDate)) + end = moment(this.maxDate); + + // If the end of the range is before the minimum (if min is set) OR + // the start of the range is after the max (also if set) don't display this + // range option. + if ((this.minDate && end.isBefore(this.minDate)) || (this.maxDate && start.isAfter(this.maxDate))) { + continue; + } + + this.ranges[range] = [start, end]; + } + + var list = '
            '; + for (range in this.ranges) { + list += '
          • ' + range + '
          • '; + } + list += '
          • ' + this.locale.customRangeLabel + '
          • '; + list += '
          '; + this.container.find('.ranges ul').remove(); + this.container.find('.ranges').prepend(list); + } + + if (typeof callback === 'function') { + this.cb = callback; + } + + if (!this.timePicker) { + this.startDate = this.startDate.startOf('day'); + this.endDate = this.endDate.endOf('day'); + } + + if (this.singleDatePicker) { + this.opens = 'right'; + this.container.addClass('single'); + this.container.find('.calendar.right').show(); + this.container.find('.calendar.left').hide(); + if (!this.timePicker) { + this.container.find('.ranges').hide(); + } else { + this.container.find('.ranges .daterangepicker_start_input, .ranges .daterangepicker_end_input').hide(); + } + if (!this.container.find('.calendar.right').hasClass('single')) + this.container.find('.calendar.right').addClass('single'); + } else { + this.container.removeClass('single'); + this.container.find('.calendar.right').removeClass('single'); + this.container.find('.ranges').show(); + } + + this.oldStartDate = this.startDate.clone(); + this.oldEndDate = this.endDate.clone(); + this.oldChosenLabel = this.chosenLabel; + + this.leftCalendar = { + month: moment([this.startDate.year(), this.startDate.month(), 1, this.startDate.hour(), this.startDate.minute(), this.startDate.second()]), + calendar: [] + }; + + this.rightCalendar = { + month: moment([this.endDate.year(), this.endDate.month(), 1, this.endDate.hour(), this.endDate.minute(), this.endDate.second()]), + calendar: [] + }; + + if (this.opens == 'right' || this.opens == 'center') { + //swap calendar positions + var first = this.container.find('.calendar.first'); + var second = this.container.find('.calendar.second'); + + if (second.hasClass('single')) { + second.removeClass('single'); + first.addClass('single'); + } + + first.removeClass('left').addClass('right'); + second.removeClass('right').addClass('left'); + + if (this.singleDatePicker) { + first.show(); + second.hide(); + } + } + + if (typeof options.ranges === 'undefined' && !this.singleDatePicker) { + this.container.addClass('show-calendar'); + } + + this.container.addClass('opens' + this.opens); + + this.updateView(); + this.updateCalendars(); + + }, + + setStartDate: function(startDate) { + if (typeof startDate === 'string') + this.startDate = moment(startDate, this.format).utcOffset(this.timeZone); + + if (typeof startDate === 'object') + this.startDate = moment(startDate); + + if (!this.timePicker) + this.startDate = this.startDate.startOf('day'); + + this.oldStartDate = this.startDate.clone(); + + this.updateView(); + this.updateCalendars(); + this.updateInputText(); + }, + + setEndDate: function(endDate) { + if (typeof endDate === 'string') + this.endDate = moment(endDate, this.format).utcOffset(this.timeZone); + + if (typeof endDate === 'object') + this.endDate = moment(endDate); + + if (!this.timePicker) + this.endDate = this.endDate.endOf('day'); + + this.oldEndDate = this.endDate.clone(); + + this.updateView(); + this.updateCalendars(); + this.updateInputText(); + }, + + updateView: function () { + this.leftCalendar.month.month(this.startDate.month()).year(this.startDate.year()).hour(this.startDate.hour()).minute(this.startDate.minute()); + this.rightCalendar.month.month(this.endDate.month()).year(this.endDate.year()).hour(this.endDate.hour()).minute(this.endDate.minute()); + this.updateFormInputs(); + }, + + updateFormInputs: function () { + this.container.find('input[name=daterangepicker_start]').val(this.startDate.format(this.format)); + this.container.find('input[name=daterangepicker_end]').val(this.endDate.format(this.format)); + + if (this.startDate.isSame(this.endDate) || this.startDate.isBefore(this.endDate)) { + this.container.find('button.applyBtn').removeAttr('disabled'); + } else { + this.container.find('button.applyBtn').attr('disabled', 'disabled'); + } + }, + + updateFromControl: function () { + if (!this.element.is('input')) return; + if (!this.element.val().length) return; + + var dateString = this.element.val().split(this.separator), + start = null, + end = null; + + if(dateString.length === 2) { + start = moment(dateString[0], this.format).utcOffset(this.timeZone); + end = moment(dateString[1], this.format).utcOffset(this.timeZone); + } + + if (this.singleDatePicker || start === null || end === null) { + start = moment(this.element.val(), this.format).utcOffset(this.timeZone); + end = start; + } + + if (end.isBefore(start)) return; + + this.oldStartDate = this.startDate.clone(); + this.oldEndDate = this.endDate.clone(); + + this.startDate = start; + this.endDate = end; + + if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate)) + this.notify(); + + this.updateCalendars(); + }, + + notify: function () { + this.updateView(); + this.cb(this.startDate, this.endDate, this.chosenLabel); + }, + + move: function () { + var parentOffset = { top: 0, left: 0 }; + var parentRightEdge = $(window).width(); + if (!this.parentEl.is('body')) { + parentOffset = { + top: this.parentEl.offset().top - this.parentEl.scrollTop(), + left: this.parentEl.offset().left - this.parentEl.scrollLeft() + }; + parentRightEdge = this.parentEl[0].clientWidth + this.parentEl.offset().left; + } + + if (this.opens == 'left') { + this.container.css({ + top: this.element.offset().top + this.element.outerHeight() - parentOffset.top, + right: parentRightEdge - this.element.offset().left - this.element.outerWidth(), + left: 'auto' + }); + if (this.container.offset().left < 0) { + this.container.css({ + right: 'auto', + left: 9 + }); + } + } else if (this.opens == 'center') { + this.container.css({ + top: this.element.offset().top + this.element.outerHeight() - parentOffset.top, + left: this.element.offset().left - parentOffset.left + this.element.outerWidth() / 2 + - this.container.outerWidth() / 2, + right: 'auto' + }); + if (this.container.offset().left < 0) { + this.container.css({ + right: 'auto', + left: 9 + }); + } + } else { + this.container.css({ + top: this.element.offset().top + this.element.outerHeight() - parentOffset.top, + left: this.element.offset().left - parentOffset.left, + right: 'auto' + }); + if (this.container.offset().left + this.container.outerWidth() > $(window).width()) { + this.container.css({ + left: 'auto', + right: 0 + }); + } + } + }, + + toggle: function (e) { + if (this.element.hasClass('active')) { + this.hide(); + } else { + this.show(); + } + }, + + show: function (e) { + if (this.isShowing) return; + + this.element.addClass('active'); + this.container.show(); + this.move(); + + // Create a click proxy that is private to this instance of datepicker, for unbinding + this._outsideClickProxy = $.proxy(function (e) { this.outsideClick(e); }, this); + // Bind global datepicker mousedown for hiding and + $(document) + .on('mousedown.daterangepicker', this._outsideClickProxy) + // also support mobile devices + .on('touchend.daterangepicker', this._outsideClickProxy) + // also explicitly play nice with Bootstrap dropdowns, which stopPropagation when clicking them + .on('click.daterangepicker', '[data-toggle=dropdown]', this._outsideClickProxy) + // and also close when focus changes to outside the picker (eg. tabbing between controls) + .on('focusin.daterangepicker', this._outsideClickProxy); + + this.isShowing = true; + this.element.trigger('show.daterangepicker', this); + }, + + outsideClick: function (e) { + var target = $(e.target); + // if the page is clicked anywhere except within the daterangerpicker/button + // itself then call this.hide() + if ( + // ie modal dialog fix + e.type == "focusin" || + target.closest(this.element).length || + target.closest(this.container).length || + target.closest('.calendar-date').length + ) return; + this.hide(); + }, + + hide: function (e) { + if (!this.isShowing) return; + + $(document) + .off('.daterangepicker'); + + this.element.removeClass('active'); + this.container.hide(); + + if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate)) + this.notify(); + + this.oldStartDate = this.startDate.clone(); + this.oldEndDate = this.endDate.clone(); + + this.isShowing = false; + this.element.trigger('hide.daterangepicker', this); + }, + + enterRange: function (e) { + // mouse pointer has entered a range label + var label = e.target.innerHTML; + if (label == this.locale.customRangeLabel) { + this.updateView(); + } else { + var dates = this.ranges[label]; + this.container.find('input[name=daterangepicker_start]').val(dates[0].format(this.format)); + this.container.find('input[name=daterangepicker_end]').val(dates[1].format(this.format)); + } + }, + + showCalendars: function() { + this.container.addClass('show-calendar'); + this.move(); + this.element.trigger('showCalendar.daterangepicker', this); + }, + + hideCalendars: function() { + this.container.removeClass('show-calendar'); + this.element.trigger('hideCalendar.daterangepicker', this); + }, + + // when a date is typed into the start to end date textboxes + inputsChanged: function (e) { + var el = $(e.target); + var date = moment(el.val(), this.format); + if (!date.isValid()) return; + + var startDate, endDate; + if (el.attr('name') === 'daterangepicker_start') { + startDate = (false !== this.minDate && date.isBefore(this.minDate)) ? this.minDate : date; + endDate = this.endDate; + } else { + startDate = this.startDate; + endDate = (false !== this.maxDate && date.isAfter(this.maxDate)) ? this.maxDate : date; + } + this.setCustomDates(startDate, endDate); + }, + + inputsKeydown: function(e) { + if (e.keyCode === 13) { + this.inputsChanged(e); + this.notify(); + } + }, + + updateInputText: function() { + if (this.element.is('input') && !this.singleDatePicker) { + this.element.val(this.startDate.format(this.format) + this.separator + this.endDate.format(this.format)); + this.element.trigger('change'); + } else if (this.element.is('input')) { + this.element.val(this.endDate.format(this.format)); + this.element.trigger('change'); + } + }, + + clickRange: function (e) { + var label = e.target.innerHTML; + this.chosenLabel = label; + if (label == this.locale.customRangeLabel) { + this.showCalendars(); + } else { + var dates = this.ranges[label]; + + this.startDate = dates[0]; + this.endDate = dates[1]; + + if (!this.timePicker) { + this.startDate.startOf('day'); + this.endDate.endOf('day'); + } + + this.leftCalendar.month.month(this.startDate.month()).year(this.startDate.year()).hour(this.startDate.hour()).minute(this.startDate.minute()); + this.rightCalendar.month.month(this.endDate.month()).year(this.endDate.year()).hour(this.endDate.hour()).minute(this.endDate.minute()); + this.updateCalendars(); + + this.updateInputText(); + + this.hideCalendars(); + this.hide(); + this.element.trigger('apply.daterangepicker', this); + } + }, + + clickPrev: function (e) { + var cal = $(e.target).parents('.calendar'); + if (cal.hasClass('left')) { + this.leftCalendar.month.subtract(1, 'month'); + } else { + this.rightCalendar.month.subtract(1, 'month'); + } + this.updateCalendars(); + }, + + clickNext: function (e) { + var cal = $(e.target).parents('.calendar'); + if (cal.hasClass('left')) { + this.leftCalendar.month.add(1, 'month'); + } else { + this.rightCalendar.month.add(1, 'month'); + } + this.updateCalendars(); + }, + + hoverDate: function (e) { + var title = $(e.target).attr('data-title'); + var row = title.substr(1, 1); + var col = title.substr(3, 1); + var cal = $(e.target).parents('.calendar'); + + if (cal.hasClass('left')) { + this.container.find('input[name=daterangepicker_start]').val(this.leftCalendar.calendar[row][col].format(this.format)); + } else { + this.container.find('input[name=daterangepicker_end]').val(this.rightCalendar.calendar[row][col].format(this.format)); + } + }, + + setCustomDates: function(startDate, endDate) { + this.chosenLabel = this.locale.customRangeLabel; + if (startDate.isAfter(endDate)) { + var difference = this.endDate.diff(this.startDate); + endDate = moment(startDate).add(difference, 'ms'); + if (this.maxDate && endDate.isAfter(this.maxDate)) { + endDate = this.maxDate.clone(); + } + } + this.startDate = startDate; + this.endDate = endDate; + + this.updateView(); + this.updateCalendars(); + }, + + clickDate: function (e) { + var title = $(e.target).attr('data-title'); + var row = title.substr(1, 1); + var col = title.substr(3, 1); + var cal = $(e.target).parents('.calendar'); + + var startDate, endDate; + if (cal.hasClass('left')) { + startDate = this.leftCalendar.calendar[row][col]; + endDate = this.endDate; + if (typeof this.dateLimit === 'object') { + var maxDate = moment(startDate).add(this.dateLimit).startOf('day'); + if (endDate.isAfter(maxDate)) { + endDate = maxDate; + } + } + } else { + startDate = this.startDate; + endDate = this.rightCalendar.calendar[row][col]; + if (typeof this.dateLimit === 'object') { + var minDate = moment(endDate).subtract(this.dateLimit).startOf('day'); + if (startDate.isBefore(minDate)) { + startDate = minDate; + } + } + } + + if (this.singleDatePicker && cal.hasClass('left')) { + endDate = startDate.clone(); + } else if (this.singleDatePicker && cal.hasClass('right')) { + startDate = endDate.clone(); + } + + cal.find('td').removeClass('active'); + + $(e.target).addClass('active'); + + this.setCustomDates(startDate, endDate); + + if (!this.timePicker) + endDate.endOf('day'); + + if (this.singleDatePicker && !this.timePicker) + this.clickApply(); + }, + + clickApply: function (e) { + this.updateInputText(); + this.hide(); + this.element.trigger('apply.daterangepicker', this); + }, + + clickCancel: function (e) { + this.startDate = this.oldStartDate; + this.endDate = this.oldEndDate; + this.chosenLabel = this.oldChosenLabel; + this.updateView(); + this.updateCalendars(); + this.hide(); + this.element.trigger('cancel.daterangepicker', this); + }, + + updateMonthYear: function (e) { + var isLeft = $(e.target).closest('.calendar').hasClass('left'), + leftOrRight = isLeft ? 'left' : 'right', + cal = this.container.find('.calendar.'+leftOrRight); + + // Month must be Number for new moment versions + var month = parseInt(cal.find('.monthselect').val(), 10); + var year = cal.find('.yearselect').val(); + + if (!isLeft && !this.singleDatePicker) { + if (year < this.startDate.year() || (year == this.startDate.year() && month < this.startDate.month())) { + month = this.startDate.month(); + year = this.startDate.year(); + } + } + + if (this.minDate) { + if (year < this.minDate.year() || (year == this.minDate.year() && month < this.minDate.month())) { + month = this.minDate.month(); + year = this.minDate.year(); + } + } + + if (this.maxDate) { + if (year > this.maxDate.year() || (year == this.maxDate.year() && month > this.maxDate.month())) { + month = this.maxDate.month(); + year = this.maxDate.year(); + } + } + + + this[leftOrRight+'Calendar'].month.month(month).year(year); + this.updateCalendars(); + }, + + updateTime: function(e) { + + var cal = $(e.target).closest('.calendar'), + isLeft = cal.hasClass('left'); + + var hour = parseInt(cal.find('.hourselect').val(), 10); + var minute = parseInt(cal.find('.minuteselect').val(), 10); + var second = 0; + + if (this.timePickerSeconds) { + second = parseInt(cal.find('.secondselect').val(), 10); + } + + if (this.timePicker12Hour) { + var ampm = cal.find('.ampmselect').val(); + if (ampm === 'PM' && hour < 12) + hour += 12; + if (ampm === 'AM' && hour === 12) + hour = 0; + } + + if (isLeft) { + var start = this.startDate.clone(); + start.hour(hour); + start.minute(minute); + start.second(second); + this.startDate = start; + this.leftCalendar.month.hour(hour).minute(minute).second(second); + if (this.singleDatePicker) + this.endDate = start.clone(); + } else { + var end = this.endDate.clone(); + end.hour(hour); + end.minute(minute); + end.second(second); + this.endDate = end; + if (this.singleDatePicker) + this.startDate = end.clone(); + this.rightCalendar.month.hour(hour).minute(minute).second(second); + } + + this.updateView(); + this.updateCalendars(); + }, + + updateCalendars: function () { + this.leftCalendar.calendar = this.buildCalendar(this.leftCalendar.month.month(), this.leftCalendar.month.year(), this.leftCalendar.month.hour(), this.leftCalendar.month.minute(), this.leftCalendar.month.second(), 'left'); + this.rightCalendar.calendar = this.buildCalendar(this.rightCalendar.month.month(), this.rightCalendar.month.year(), this.rightCalendar.month.hour(), this.rightCalendar.month.minute(), this.rightCalendar.month.second(), 'right'); + this.container.find('.calendar.left').empty().html(this.renderCalendar(this.leftCalendar.calendar, this.startDate, this.minDate, this.maxDate, 'left')); + this.container.find('.calendar.right').empty().html(this.renderCalendar(this.rightCalendar.calendar, this.endDate, this.singleDatePicker ? this.minDate : this.startDate, this.maxDate, 'right')); + + this.container.find('.ranges li').removeClass('active'); + var customRange = true; + var i = 0; + for (var range in this.ranges) { + if (this.timePicker) { + if (this.startDate.isSame(this.ranges[range][0]) && this.endDate.isSame(this.ranges[range][1])) { + customRange = false; + this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')') + .addClass('active').html(); + } + } else { + //ignore times when comparing dates if time picker is not enabled + if (this.startDate.format('YYYY-MM-DD') == this.ranges[range][0].format('YYYY-MM-DD') && this.endDate.format('YYYY-MM-DD') == this.ranges[range][1].format('YYYY-MM-DD')) { + customRange = false; + this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')') + .addClass('active').html(); + } + } + i++; + } + if (customRange) { + this.chosenLabel = this.container.find('.ranges li:last').addClass('active').html(); + this.showCalendars(); + } + }, + + buildCalendar: function (month, year, hour, minute, second, side) { + var daysInMonth = moment([year, month]).daysInMonth(); + var firstDay = moment([year, month, 1]); + var lastDay = moment([year, month, daysInMonth]); + var lastMonth = moment(firstDay).subtract(1, 'month').month(); + var lastYear = moment(firstDay).subtract(1, 'month').year(); + + var daysInLastMonth = moment([lastYear, lastMonth]).daysInMonth(); + + var dayOfWeek = firstDay.day(); + + var i; + + //initialize a 6 rows x 7 columns array for the calendar + var calendar = []; + calendar.firstDay = firstDay; + calendar.lastDay = lastDay; + + for (i = 0; i < 6; i++) { + calendar[i] = []; + } + + //populate the calendar with date objects + var startDay = daysInLastMonth - dayOfWeek + this.locale.firstDay + 1; + if (startDay > daysInLastMonth) + startDay -= 7; + + if (dayOfWeek == this.locale.firstDay) + startDay = daysInLastMonth - 6; + + var curDate = moment([lastYear, lastMonth, startDay, 12, minute, second]).utcOffset(this.timeZone); + + var col, row; + for (i = 0, col = 0, row = 0; i < 42; i++, col++, curDate = moment(curDate).add(24, 'hour')) { + if (i > 0 && col % 7 === 0) { + col = 0; + row++; + } + calendar[row][col] = curDate.clone().hour(hour); + curDate.hour(12); + + if (this.minDate && calendar[row][col].format('YYYY-MM-DD') == this.minDate.format('YYYY-MM-DD') && calendar[row][col].isBefore(this.minDate) && side == 'left') { + calendar[row][col] = this.minDate.clone(); + } + + if (this.maxDate && calendar[row][col].format('YYYY-MM-DD') == this.maxDate.format('YYYY-MM-DD') && calendar[row][col].isAfter(this.maxDate) && side == 'right') { + calendar[row][col] = this.maxDate.clone(); + } + + } + + return calendar; + }, + + renderDropdowns: function (selected, minDate, maxDate) { + var currentMonth = selected.month(); + var currentYear = selected.year(); + var maxYear = (maxDate && maxDate.year()) || (currentYear + 5); + var minYear = (minDate && minDate.year()) || (currentYear - 50); + + var monthHtml = '"; + + var yearHtml = ''; + + return monthHtml + yearHtml; + }, + + renderCalendar: function (calendar, selected, minDate, maxDate, side) { + + var html = '
          '; + html += ''; + html += ''; + html += ''; + + // add empty cell for week number + if (this.showWeekNumbers) + html += ''; + + if (!minDate || minDate.isBefore(calendar.firstDay)) { + html += ''; + } else { + html += ''; + } + + var dateHtml = this.locale.monthNames[calendar[1][1].month()] + calendar[1][1].format(" YYYY"); + + if (this.showDropdowns) { + dateHtml = this.renderDropdowns(calendar[1][1], minDate, maxDate); + } + + html += ''; + if (!maxDate || maxDate.isAfter(calendar.lastDay)) { + html += ''; + } else { + html += ''; + } + + html += ''; + html += ''; + + // add week number label + if (this.showWeekNumbers) + html += ''; + + $.each(this.locale.daysOfWeek, function (index, dayOfWeek) { + html += ''; + }); + + html += ''; + html += ''; + html += ''; + + for (var row = 0; row < 6; row++) { + html += ''; + + // add week number + if (this.showWeekNumbers) + html += ''; + + for (var col = 0; col < 7; col++) { + var cname = 'available '; + cname += (calendar[row][col].month() == calendar[1][1].month()) ? '' : 'off'; + + if ((minDate && calendar[row][col].isBefore(minDate, 'day')) || (maxDate && calendar[row][col].isAfter(maxDate, 'day'))) { + cname = ' off disabled '; + } else if (calendar[row][col].format('YYYY-MM-DD') == selected.format('YYYY-MM-DD')) { + cname += ' active '; + if (calendar[row][col].format('YYYY-MM-DD') == this.startDate.format('YYYY-MM-DD')) { + cname += ' start-date '; + } + if (calendar[row][col].format('YYYY-MM-DD') == this.endDate.format('YYYY-MM-DD')) { + cname += ' end-date '; + } + } else if (calendar[row][col] >= this.startDate && calendar[row][col] <= this.endDate) { + cname += ' in-range '; + if (calendar[row][col].isSame(this.startDate)) { cname += ' start-date '; } + if (calendar[row][col].isSame(this.endDate)) { cname += ' end-date '; } + } + + var title = 'r' + row + 'c' + col; + html += ''; + } + html += ''; + } + + html += ''; + html += '
          ' + dateHtml + '
          ' + this.locale.weekLabel + '' + dayOfWeek + '
          ' + calendar[row][0].week() + '' + calendar[row][col].date() + '
          '; + html += '
          '; + + var i; + if (this.timePicker) { + + html += '
          '; + html += ' : '; + + html += ' '; + + if (this.timePickerSeconds) { + html += ': '; + } + + if (this.timePicker12Hour) { + html += ''; + } + + html += '
          '; + + } + + return html; + + }, + + remove: function() { + + this.container.remove(); + this.element.off('.daterangepicker'); + this.element.removeData('daterangepicker'); + + } + + }; + + $.fn.daterangepicker = function (options, cb) { + this.each(function () { + var el = $(this); + if (el.data('daterangepicker')) + el.data('daterangepicker').remove(); + el.data('daterangepicker', new DateRangePicker(el, options, cb)); + }); + return this; + }; + +})); diff --git a/culturefeed_search_ui/js/moment.min.js b/culturefeed_search_ui/js/moment.min.js new file mode 100644 index 00000000..024d488f --- /dev/null +++ b/culturefeed_search_ui/js/moment.min.js @@ -0,0 +1,7 @@ +//! moment.js +//! version : 2.9.0 +//! authors : Tim Wood, Iskren Chernev, Moment.js contributors +//! license : MIT +//! momentjs.com +(function(a){function b(a,b,c){switch(arguments.length){case 2:return null!=a?a:b;case 3:return null!=a?a:null!=b?b:c;default:throw new Error("Implement me")}}function c(a,b){return Bb.call(a,b)}function d(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function e(a){vb.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+a)}function f(a,b){var c=!0;return o(function(){return c&&(e(a),c=!1),b.apply(this,arguments)},b)}function g(a,b){sc[a]||(e(b),sc[a]=!0)}function h(a,b){return function(c){return r(a.call(this,c),b)}}function i(a,b){return function(c){return this.localeData().ordinal(a.call(this,c),b)}}function j(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function k(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function l(){}function m(a,b){b!==!1&&H(a),p(this,a),this._d=new Date(+a._d),uc===!1&&(uc=!0,vb.updateOffset(this),uc=!1)}function n(a){var b=A(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=vb.localeData(),this._bubble()}function o(a,b){for(var d in b)c(b,d)&&(a[d]=b[d]);return c(b,"toString")&&(a.toString=b.toString),c(b,"valueOf")&&(a.valueOf=b.valueOf),a}function p(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=b._pf),"undefined"!=typeof b._locale&&(a._locale=b._locale),Kb.length>0)for(c in Kb)d=Kb[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.lengthd;d++)(c&&a[d]!==b[d]||!c&&C(a[d])!==C(b[d]))&&g++;return g+f}function z(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=lc[a]||mc[b]||b}return a}function A(a){var b,d,e={};for(d in a)c(a,d)&&(b=z(d),b&&(e[b]=a[d]));return e}function B(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}vb[b]=function(e,f){var g,h,i=vb._locale[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=vb().utc().set(d,a);return i.call(vb._locale,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function C(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function D(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function E(a,b,c){return jb(vb([a,11,31+b-c]),b,c).week}function F(a){return G(a)?366:365}function G(a){return a%4===0&&a%100!==0||a%400===0}function H(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[Db]<0||a._a[Db]>11?Db:a._a[Eb]<1||a._a[Eb]>D(a._a[Cb],a._a[Db])?Eb:a._a[Fb]<0||a._a[Fb]>24||24===a._a[Fb]&&(0!==a._a[Gb]||0!==a._a[Hb]||0!==a._a[Ib])?Fb:a._a[Gb]<0||a._a[Gb]>59?Gb:a._a[Hb]<0||a._a[Hb]>59?Hb:a._a[Ib]<0||a._a[Ib]>999?Ib:-1,a._pf._overflowDayOfYear&&(Cb>b||b>Eb)&&(b=Eb),a._pf.overflow=b)}function I(b){return null==b._isValid&&(b._isValid=!isNaN(b._d.getTime())&&b._pf.overflow<0&&!b._pf.empty&&!b._pf.invalidMonth&&!b._pf.nullInput&&!b._pf.invalidFormat&&!b._pf.userInvalidated,b._strict&&(b._isValid=b._isValid&&0===b._pf.charsLeftOver&&0===b._pf.unusedTokens.length&&b._pf.bigHour===a)),b._isValid}function J(a){return a?a.toLowerCase().replace("_","-"):a}function K(a){for(var b,c,d,e,f=0;f0;){if(d=L(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&y(e,c,!0)>=b-1)break;b--}f++}return null}function L(a){var b=null;if(!Jb[a]&&Lb)try{b=vb.locale(),require("./locale/"+a),vb.locale(b)}catch(c){}return Jb[a]}function M(a,b){var c,d;return b._isUTC?(c=b.clone(),d=(vb.isMoment(a)||x(a)?+a:+vb(a))-+c,c._d.setTime(+c._d+d),vb.updateOffset(c,!1),c):vb(a).local()}function N(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function O(a){var b,c,d=a.match(Pb);for(b=0,c=d.length;c>b;b++)d[b]=rc[d[b]]?rc[d[b]]:N(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function P(a,b){return a.isValid()?(b=Q(b,a.localeData()),nc[b]||(nc[b]=O(b)),nc[b](a)):a.localeData().invalidDate()}function Q(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Qb.lastIndex=0;d>=0&&Qb.test(a);)a=a.replace(Qb,c),Qb.lastIndex=0,d-=1;return a}function R(a,b){var c,d=b._strict;switch(a){case"Q":return _b;case"DDDD":return bc;case"YYYY":case"GGGG":case"gggg":return d?cc:Tb;case"Y":case"G":case"g":return ec;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?dc:Ub;case"S":if(d)return _b;case"SS":if(d)return ac;case"SSS":if(d)return bc;case"DDD":return Sb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Wb;case"a":case"A":return b._locale._meridiemParse;case"x":return Zb;case"X":return $b;case"Z":case"ZZ":return Xb;case"T":return Yb;case"SSSS":return Vb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?ac:Rb;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Rb;case"Do":return d?b._locale._ordinalParse:b._locale._ordinalParseLenient;default:return c=new RegExp($(Z(a.replace("\\","")),"i"))}}function S(a){a=a||"";var b=a.match(Xb)||[],c=b[b.length-1]||[],d=(c+"").match(jc)||["-",0,0],e=+(60*d[1])+C(d[2]);return"+"===d[0]?e:-e}function T(a,b,c){var d,e=c._a;switch(a){case"Q":null!=b&&(e[Db]=3*(C(b)-1));break;case"M":case"MM":null!=b&&(e[Db]=C(b)-1);break;case"MMM":case"MMMM":d=c._locale.monthsParse(b,a,c._strict),null!=d?e[Db]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[Eb]=C(b));break;case"Do":null!=b&&(e[Eb]=C(parseInt(b.match(/\d{1,2}/)[0],10)));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=C(b));break;case"YY":e[Cb]=vb.parseTwoDigitYear(b);break;case"YYYY":case"YYYYY":case"YYYYYY":e[Cb]=C(b);break;case"a":case"A":c._meridiem=b;break;case"h":case"hh":c._pf.bigHour=!0;case"H":case"HH":e[Fb]=C(b);break;case"m":case"mm":e[Gb]=C(b);break;case"s":case"ss":e[Hb]=C(b);break;case"S":case"SS":case"SSS":case"SSSS":e[Ib]=C(1e3*("0."+b));break;case"x":c._d=new Date(C(b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=S(b);break;case"dd":case"ddd":case"dddd":d=c._locale.weekdaysParse(b),null!=d?(c._w=c._w||{},c._w.d=d):c._pf.invalidWeekday=b;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":a=a.substr(0,1);case"gggg":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=C(b));break;case"gg":case"GG":c._w=c._w||{},c._w[a]=vb.parseTwoDigitYear(b)}}function U(a){var c,d,e,f,g,h,i;c=a._w,null!=c.GG||null!=c.W||null!=c.E?(g=1,h=4,d=b(c.GG,a._a[Cb],jb(vb(),1,4).year),e=b(c.W,1),f=b(c.E,1)):(g=a._locale._week.dow,h=a._locale._week.doy,d=b(c.gg,a._a[Cb],jb(vb(),g,h).year),e=b(c.w,1),null!=c.d?(f=c.d,g>f&&++e):f=null!=c.e?c.e+g:g),i=kb(d,e,f,h,g),a._a[Cb]=i.year,a._dayOfYear=i.dayOfYear}function V(a){var c,d,e,f,g=[];if(!a._d){for(e=X(a),a._w&&null==a._a[Eb]&&null==a._a[Db]&&U(a),a._dayOfYear&&(f=b(a._a[Cb],e[Cb]),a._dayOfYear>F(f)&&(a._pf._overflowDayOfYear=!0),d=fb(f,0,a._dayOfYear),a._a[Db]=d.getUTCMonth(),a._a[Eb]=d.getUTCDate()),c=0;3>c&&null==a._a[c];++c)a._a[c]=g[c]=e[c];for(;7>c;c++)a._a[c]=g[c]=null==a._a[c]?2===c?1:0:a._a[c];24===a._a[Fb]&&0===a._a[Gb]&&0===a._a[Hb]&&0===a._a[Ib]&&(a._nextDay=!0,a._a[Fb]=0),a._d=(a._useUTC?fb:eb).apply(null,g),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Fb]=24)}}function W(a){var b;a._d||(b=A(a._i),a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],V(a))}function X(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function Y(b){if(b._f===vb.ISO_8601)return void ab(b);b._a=[],b._pf.empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Q(b._f,b._locale).match(Pb)||[],c=0;c0&&b._pf.unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),rc[f]?(d?b._pf.empty=!1:b._pf.unusedTokens.push(f),T(f,d,b)):b._strict&&!d&&b._pf.unusedTokens.push(f);b._pf.charsLeftOver=i-j,h.length>0&&b._pf.unusedInput.push(h),b._pf.bigHour===!0&&b._a[Fb]<=12&&(b._pf.bigHour=a),b._a[Fb]=k(b._locale,b._a[Fb],b._meridiem),V(b),H(b)}function Z(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function $(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function _(a){var b,c,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;fg)&&(e=g,c=b));o(a,c||b)}function ab(a){var b,c,d=a._i,e=fc.exec(d);if(e){for(a._pf.iso=!0,b=0,c=hc.length;c>b;b++)if(hc[b][1].exec(d)){a._f=hc[b][0]+(e[6]||" ");break}for(b=0,c=ic.length;c>b;b++)if(ic[b][1].exec(d)){a._f+=ic[b][0];break}d.match(Xb)&&(a._f+="Z"),Y(a)}else a._isValid=!1}function bb(a){ab(a),a._isValid===!1&&(delete a._isValid,vb.createFromInputFallback(a))}function cb(a,b){var c,d=[];for(c=0;ca&&h.setFullYear(a),h}function fb(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function gb(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function hb(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function ib(a,b,c){var d=vb.duration(a).abs(),e=Ab(d.as("s")),f=Ab(d.as("m")),g=Ab(d.as("h")),h=Ab(d.as("d")),i=Ab(d.as("M")),j=Ab(d.as("y")),k=e0,k[4]=c,hb.apply({},k)}function jb(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=vb(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function kb(a,b,c,d,e){var f,g,h=fb(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:F(a-1)+g}}function lb(b){var c,d=b._i,e=b._f;return b._locale=b._locale||vb.localeData(b._l),null===d||e===a&&""===d?vb.invalid({nullInput:!0}):("string"==typeof d&&(b._i=d=b._locale.preparse(d)),vb.isMoment(d)?new m(d,!0):(e?w(e)?_(b):Y(b):db(b),c=new m(b),c._nextDay&&(c.add(1,"d"),c._nextDay=a),c))}function mb(a,b){var c,d;if(1===b.length&&w(b[0])&&(b=b[0]),!b.length)return vb();for(c=b[0],d=1;d=0?"+":"-";return b+r(Math.abs(a),6)},gg:function(){return r(this.weekYear()%100,2)},gggg:function(){return r(this.weekYear(),4)},ggggg:function(){return r(this.weekYear(),5)},GG:function(){return r(this.isoWeekYear()%100,2)},GGGG:function(){return r(this.isoWeekYear(),4)},GGGGG:function(){return r(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return C(this.milliseconds()/100)},SS:function(){return r(C(this.milliseconds()/10),2)},SSS:function(){return r(this.milliseconds(),3)},SSSS:function(){return r(this.milliseconds(),3)},Z:function(){var a=this.utcOffset(),b="+";return 0>a&&(a=-a,b="-"),b+r(C(a/60),2)+":"+r(C(a)%60,2)},ZZ:function(){var a=this.utcOffset(),b="+";return 0>a&&(a=-a,b="-"),b+r(C(a/60),2)+r(C(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},x:function(){return this.valueOf()},X:function(){return this.unix()},Q:function(){return this.quarter()}},sc={},tc=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"],uc=!1;pc.length;)xb=pc.pop(),rc[xb+"o"]=i(rc[xb],xb);for(;qc.length;)xb=qc.pop(),rc[xb+xb]=h(rc[xb],2);rc.DDDD=h(rc.DDD,3),o(l.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a,b,c){var d,e,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=vb.utc([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=vb([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.apply(b,[c]):d},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",_ordinalParse:/\d{1,2}/,preparse:function(a){return a},postformat:function(a){return a},week:function(a){return jb(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},firstDayOfWeek:function(){return this._week.dow},firstDayOfYear:function(){return this._week.doy},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),vb=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=b,g._f=c,g._l=e,g._strict=f,g._isUTC=!1,g._pf=d(),lb(g)},vb.suppressDeprecationWarnings=!1,vb.createFromInputFallback=f("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),vb.min=function(){var a=[].slice.call(arguments,0);return mb("isBefore",a)},vb.max=function(){var a=[].slice.call(arguments,0);return mb("isAfter",a)},vb.utc=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=b,g._f=c,g._strict=f,g._pf=d(),lb(g).utc()},vb.unix=function(a){return vb(1e3*a)},vb.duration=function(a,b){var d,e,f,g,h=a,i=null;return vb.isDuration(a)?h={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(h={},b?h[b]=a:h.milliseconds=a):(i=Nb.exec(a))?(d="-"===i[1]?-1:1,h={y:0,d:C(i[Eb])*d,h:C(i[Fb])*d,m:C(i[Gb])*d,s:C(i[Hb])*d,ms:C(i[Ib])*d}):(i=Ob.exec(a))?(d="-"===i[1]?-1:1,f=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*d},h={y:f(i[2]),M:f(i[3]),d:f(i[4]),h:f(i[5]),m:f(i[6]),s:f(i[7]),w:f(i[8])}):null==h?h={}:"object"==typeof h&&("from"in h||"to"in h)&&(g=t(vb(h.from),vb(h.to)),h={},h.ms=g.milliseconds,h.M=g.months),e=new n(h),vb.isDuration(a)&&c(a,"_locale")&&(e._locale=a._locale),e},vb.version=yb,vb.defaultFormat=gc,vb.ISO_8601=function(){},vb.momentProperties=Kb,vb.updateOffset=function(){},vb.relativeTimeThreshold=function(b,c){return oc[b]===a?!1:c===a?oc[b]:(oc[b]=c,!0)},vb.lang=f("moment.lang is deprecated. Use moment.locale instead.",function(a,b){return vb.locale(a,b)}),vb.locale=function(a,b){var c;return a&&(c="undefined"!=typeof b?vb.defineLocale(a,b):vb.localeData(a),c&&(vb.duration._locale=vb._locale=c)),vb._locale._abbr},vb.defineLocale=function(a,b){return null!==b?(b.abbr=a,Jb[a]||(Jb[a]=new l),Jb[a].set(b),vb.locale(a),Jb[a]):(delete Jb[a],null)},vb.langData=f("moment.langData is deprecated. Use moment.localeData instead.",function(a){return vb.localeData(a)}),vb.localeData=function(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return vb._locale;if(!w(a)){if(b=L(a))return b;a=[a]}return K(a)},vb.isMoment=function(a){return a instanceof m||null!=a&&c(a,"_isAMomentObject")},vb.isDuration=function(a){return a instanceof n};for(xb=tc.length-1;xb>=0;--xb)B(tc[xb]);vb.normalizeUnits=function(a){return z(a)},vb.invalid=function(a){var b=vb.utc(0/0);return null!=a?o(b._pf,a):b._pf.userInvalidated=!0,b},vb.parseZone=function(){return vb.apply(null,arguments).parseZone()},vb.parseTwoDigitYear=function(a){return C(a)+(C(a)>68?1900:2e3)},vb.isDate=x,o(vb.fn=m.prototype,{clone:function(){return vb(this)},valueOf:function(){return+this._d-6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=vb(this).utc();return 00:!1},parsingFlags:function(){return o({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(a){return this.utcOffset(0,a)},local:function(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(this._dateUtcOffset(),"m")),this},format:function(a){var b=P(this,a||vb.defaultFormat);return this.localeData().postformat(b)},add:u(1,"add"),subtract:u(-1,"subtract"),diff:function(a,b,c){var d,e,f=M(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=z(b),"year"===b||"month"===b||"quarter"===b?(e=j(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:q(e)},from:function(a,b){return vb.duration({to:this,from:a}).locale(this.locale()).humanize(!b)},fromNow:function(a){return this.from(vb(),a)},calendar:function(a){var b=a||vb(),c=M(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,vb(b)))},isLeapYear:function(){return G(this.year())},isDST:function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=gb(a,this.localeData()),this.add(a-b,"d")):b},month:qb("Month",!0),startOf:function(a){switch(a=z(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(b){return b=z(b),b===a||"millisecond"===b?this:this.startOf(b).add(1,"isoWeek"===b?"week":b).subtract(1,"ms")},isAfter:function(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=vb.isMoment(a)?a:vb(a),+this>+a):(c=vb.isMoment(a)?+a:+vb(a),c<+this.clone().startOf(b))},isBefore:function(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=vb.isMoment(a)?a:vb(a),+a>+this):(c=vb.isMoment(a)?+a:+vb(a),+this.clone().endOf(b)a?this:a}),max:f("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(a){return a=vb.apply(null,arguments),a>this?this:a}),zone:f("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",function(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}),utcOffset:function(a,b){var c,d=this._offset||0;return null!=a?("string"==typeof a&&(a=S(a)),Math.abs(a)<16&&(a=60*a),!this._isUTC&&b&&(c=this._dateUtcOffset()),this._offset=a,this._isUTC=!0,null!=c&&this.add(c,"m"),d!==a&&(!b||this._changeInProgress?v(this,vb.duration(a-d,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,vb.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?d:this._dateUtcOffset()},isLocal:function(){return!this._isUTC},isUtcOffset:function(){return this._isUTC},isUtc:function(){return this._isUTC&&0===this._offset},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(S(this._i)),this},hasAlignedHourOffset:function(a){return a=a?vb(a).utcOffset():0,(this.utcOffset()-a)%60===0},daysInMonth:function(){return D(this.year(),this.month())},dayOfYear:function(a){var b=Ab((vb(this).startOf("day")-vb(this).startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")},quarter:function(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)},weekYear:function(a){var b=jb(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")},isoWeekYear:function(a){var b=jb(this,1,4).year;return null==a?b:this.add(a-b,"y")},week:function(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")},isoWeek:function(a){var b=jb(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")},weekday:function(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return E(this.year(),1,4)},weeksInYear:function(){var a=this.localeData()._week;return E(this.year(),a.dow,a.doy)},get:function(a){return a=z(a),this[a]()},set:function(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else a=z(a),"function"==typeof this[a]&&this[a](b);return this},locale:function(b){var c;return b===a?this._locale._abbr:(c=vb.localeData(b),null!=c&&(this._locale=c),this)},lang:f("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(b){return b===a?this.localeData():this.locale(b)}),localeData:function(){return this._locale},_dateUtcOffset:function(){return 15*-Math.round(this._d.getTimezoneOffset()/15)}}),vb.fn.millisecond=vb.fn.milliseconds=qb("Milliseconds",!1),vb.fn.second=vb.fn.seconds=qb("Seconds",!1),vb.fn.minute=vb.fn.minutes=qb("Minutes",!1),vb.fn.hour=vb.fn.hours=qb("Hours",!0),vb.fn.date=qb("Date",!0),vb.fn.dates=f("dates accessor is deprecated. Use date instead.",qb("Date",!0)),vb.fn.year=qb("FullYear",!0),vb.fn.years=f("years accessor is deprecated. Use year instead.",qb("FullYear",!0)),vb.fn.days=vb.fn.day,vb.fn.months=vb.fn.month,vb.fn.weeks=vb.fn.week,vb.fn.isoWeeks=vb.fn.isoWeek,vb.fn.quarters=vb.fn.quarter,vb.fn.toJSON=vb.fn.toISOString,vb.fn.isUTC=vb.fn.isUtc,o(vb.duration.fn=n.prototype,{_bubble:function(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;g.milliseconds=d%1e3,a=q(d/1e3),g.seconds=a%60,b=q(a/60),g.minutes=b%60,c=q(b/60),g.hours=c%24,e+=q(c/24),h=q(rb(e)),e-=q(sb(h)),f+=q(e/30),e%=30,h+=q(f/12),f%=12,g.days=e,g.months=f,g.years=h},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return q(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*C(this._months/12) +},humanize:function(a){var b=ib(this,!a,this.localeData());return a&&(b=this.localeData().pastFuture(+this,b)),this.localeData().postformat(b)},add:function(a,b){var c=vb.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=vb.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=z(a),this[a.toLowerCase()+"s"]()},as:function(a){var b,c;if(a=z(a),"month"===a||"year"===a)return b=this._days+this._milliseconds/864e5,c=this._months+12*rb(b),"month"===a?c:c/12;switch(b=this._days+Math.round(sb(this._months/12)),a){case"week":return b/7+this._milliseconds/6048e5;case"day":return b+this._milliseconds/864e5;case"hour":return 24*b+this._milliseconds/36e5;case"minute":return 24*b*60+this._milliseconds/6e4;case"second":return 24*b*60*60+this._milliseconds/1e3;case"millisecond":return Math.floor(24*b*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+a)}},lang:vb.fn.lang,locale:vb.fn.locale,toIsoString:f("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"},localeData:function(){return this._locale},toJSON:function(){return this.toISOString()}}),vb.duration.fn.toString=vb.duration.fn.toISOString;for(xb in kc)c(kc,xb)&&tb(xb.toLowerCase());vb.duration.fn.asMilliseconds=function(){return this.as("ms")},vb.duration.fn.asSeconds=function(){return this.as("s")},vb.duration.fn.asMinutes=function(){return this.as("m")},vb.duration.fn.asHours=function(){return this.as("h")},vb.duration.fn.asDays=function(){return this.as("d")},vb.duration.fn.asWeeks=function(){return this.as("weeks")},vb.duration.fn.asMonths=function(){return this.as("M")},vb.duration.fn.asYears=function(){return this.as("y")},vb.locale("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===C(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),Lb?module.exports=vb:"function"==typeof define&&define.amd?(define(function(a,b,c){return c.config&&c.config()&&c.config().noGlobal===!0&&(zb.moment=wb),vb}),ub(!0)):ub()}).call(this); \ No newline at end of file diff --git a/culturefeed_search_ui/js/search_ui.js b/culturefeed_search_ui/js/search_ui.js index 7c50fde6..4eb3aabb 100644 --- a/culturefeed_search_ui/js/search_ui.js +++ b/culturefeed_search_ui/js/search_ui.js @@ -13,7 +13,7 @@ Drupal.CulturefeedSearch = Drupal.CulturefeedSearch || {}; if ($('#edit-sort').length > 0) { Drupal.CulturefeedSearch.bindSortDropdown(); } - if ($('#edit-date-range').length > 0) { + if ($('#specific-dates-range').length > 0) { Drupal.CulturefeedSearch.bindDatePicker(); } @@ -26,21 +26,67 @@ Drupal.CulturefeedSearch = Drupal.CulturefeedSearch || {}; * Bind the datepicker functionality. */ Drupal.CulturefeedSearch.bindDatePicker = function() { - $('#edit-date-range').daterangepicker({ - presetRanges: [], - presets : { - specificDate: Drupal.t('Specific date'), - dateRange: Drupal.t('Period from/to') - }, - rangeStartTitle: Drupal.t('Start date'), - rangeEndTitle: Drupal.t('End date'), - doneButtonText: Drupal.t('OK'), - dateFormat: 'd/m/yy', - earliestDate : Date.parse(), - constrainDates : true, - appendTo: '.form-item-date-range' + var format = 'DD/MM/YYYY'; + var from = $('#edit-date-from').val(); + var to = $('#edit-date-to').val(); + + $('#edit-date-from').hide(); + $('#edit-date-to').hide(); + $('#submit-specific-dates').hide(); + + if (from && to) { + $('#specific-dates-range span').html(from + ' - ' + to); + } + + $('#specific-dates-range').daterangepicker({ + format: format, + startDate: from ? from : moment(), + endDate: to ? to : moment(), + opens: 'right', + showWeekNumbers: false, + applyClass: "btn-primary", + cancelClass: "btn-link", + locale: { + cancelLabel: Drupal.t('Cancel'), + applyLabel: Drupal.t('Apply'), + fromLabel: Drupal.t('Between'), + toLabel: Drupal.t('And'), + monthNames: [ + Drupal.t('January'), + Drupal.t('February'), + Drupal.t('March'), + Drupal.t('April'), + Drupal.t('May'), + Drupal.t('June'), + Drupal.t('July'), + Drupal.t('August'), + Drupal.t('September'), + Drupal.t('October'), + Drupal.t('November'), + Drupal.t('December') + ], + daysOfWeek: [ + Drupal.t('Sun'), + Drupal.t('Mon'), + Drupal.t('Tue'), + Drupal.t('Wed'), + Drupal.t('Thu'), + Drupal.t('Fri'), + Drupal.t('Sat') + ], + firstDay: 1 + } + }, function(start, end) { + var from = start.format(format); + var to = end.format(format); + $('#specific-dates-range span').html(from + ' - ' + to); + $('#edit-date-from').val(from); + $('#edit-date-to').val(to); + $('#specific-dates-range').closest('form').submit(); + }).click(function (e) { + e.preventDefault(); }); - } + }; /** * Click listener on autosubmit fields. From 8988949262814aef2cbfa9718a0b4ce97e07ce68 Mon Sep 17 00:00:00 2001 From: Dietrich Moerman Date: Sat, 28 Mar 2015 23:42:49 +0100 Subject: [PATCH 060/275] UIT-38: Validate dates in JS. --- culturefeed_search_ui/js/search_ui.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/culturefeed_search_ui/js/search_ui.js b/culturefeed_search_ui/js/search_ui.js index 4eb3aabb..8e861ef4 100644 --- a/culturefeed_search_ui/js/search_ui.js +++ b/culturefeed_search_ui/js/search_ui.js @@ -27,8 +27,10 @@ Drupal.CulturefeedSearch = Drupal.CulturefeedSearch || {}; */ Drupal.CulturefeedSearch.bindDatePicker = function() { var format = 'DD/MM/YYYY'; - var from = $('#edit-date-from').val(); - var to = $('#edit-date-to').val(); + var from = moment($('#edit-date-from').val(), format, true).isValid() + ? $('#edit-date-from').val() : null; + var to = moment($('#edit-date-to').val(), format, true).isValid() + ? $('#edit-date-to').val() : null; $('#edit-date-from').hide(); $('#edit-date-to').hide(); From 842fb126a9d357e9d36cbb9d3aeff7c7c25edd21 Mon Sep 17 00:00:00 2001 From: Dietrich Moerman Date: Mon, 30 Mar 2015 11:06:31 +0200 Subject: [PATCH 061/275] UIT-38: Use JS library versions from prototype. --- .../css/daterangepicker-bs2.css | 287 ------------------ .../css/daterangepicker-bs3.css | 264 +++------------- .../culturefeed_search_ui.module | 4 +- culturefeed_search_ui/js/daterangepicker.js | 115 +++---- culturefeed_search_ui/js/moment.min.js | 5 +- 5 files changed, 111 insertions(+), 564 deletions(-) delete mode 100644 culturefeed_search_ui/css/daterangepicker-bs2.css diff --git a/culturefeed_search_ui/css/daterangepicker-bs2.css b/culturefeed_search_ui/css/daterangepicker-bs2.css deleted file mode 100644 index e222688a..00000000 --- a/culturefeed_search_ui/css/daterangepicker-bs2.css +++ /dev/null @@ -1,287 +0,0 @@ -/*! - * Stylesheet for the Date Range Picker, for use with Bootstrap 2.x - * - * Copyright 2013-2015 Dan Grossman ( http://www.dangrossman.info ) - * Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php - * - * Built for http://www.improvely.com - */ - -.daterangepicker.dropdown-menu { - max-width: none; - z-index: 3000; -} - -.daterangepicker.opensleft .ranges, .daterangepicker.opensleft .calendar { - float: left; - margin: 4px; -} - -.daterangepicker.opensright .ranges, .daterangepicker.opensright .calendar, -.daterangepicker.openscenter .ranges, .daterangepicker.openscenter .calendar { - float: right; - margin: 4px; -} - -.daterangepicker .ranges { - width: 160px; - text-align: left; -} - -.daterangepicker .ranges .range_inputs>div { - float: left; -} - -.daterangepicker .ranges .range_inputs>div:nth-child(2) { - padding-left: 11px; -} - -.daterangepicker .calendar { - display: none; - max-width: 250px; -} -.daterangepicker.show-calendar .calendar { - display: block; -} - -.daterangepicker .calendar.single .calendar-date { - border: none; -} - -.daterangepicker .calendar th, .daterangepicker .calendar td { - font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; - white-space: nowrap; - text-align: center; -} - -.daterangepicker .daterangepicker_start_input label, -.daterangepicker .daterangepicker_end_input label { - color: #333; - font-size: 11px; - margin-bottom: 2px; - text-transform: uppercase; - text-shadow: 1px 1px 0 #fff; -} - -.daterangepicker .ranges input { - font-size: 11px; -} - -.daterangepicker .ranges ul { - list-style: none; - margin: 0; - padding: 0; -} - -.daterangepicker .ranges li { - font-size: 13px; - background: #f5f5f5; - border: 1px solid #f5f5f5; - color: #08c; - padding: 3px 12px; - margin-bottom: 8px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - cursor: pointer; -} - -.daterangepicker .ranges li.active, .daterangepicker .ranges li:hover { - background: #08c; - border: 1px solid #08c; - color: #fff; -} - -.daterangepicker .calendar-date { - border: 1px solid #ddd; - padding: 4px; - border-radius: 4px; - background: #fff; -} - -.daterangepicker .calendar-time { - text-align: center; - margin: 8px auto 0 auto; - line-height: 30px; -} - -.daterangepicker { - position: absolute; - background: #fff; - top: 100px; - left: 20px; - padding: 4px; - margin-top: 1px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -.daterangepicker.opensleft:before { - position: absolute; - top: -7px; - right: 9px; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; -} - -.daterangepicker.opensleft:after { - position: absolute; - top: -6px; - right: 10px; - display: inline-block; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-left: 6px solid transparent; - content: ''; -} - -.daterangepicker.openscenter:before { - position: absolute; - top: -7px; - left: 0; - right: 0; - width: 0; - margin-left: auto; - margin-right: auto; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; -} - -.daterangepicker.openscenter:after { - position: absolute; - top: -6px; - left: 0; - right: 0; - width: 0; - margin-left: auto; - margin-right: auto; - display: inline-block; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-left: 6px solid transparent; - content: ''; -} - -.daterangepicker.opensright:before { - position: absolute; - top: -7px; - left: 9px; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; -} - -.daterangepicker.opensright:after { - position: absolute; - top: -6px; - left: 10px; - display: inline-block; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-left: 6px solid transparent; - content: ''; -} - -.daterangepicker table { - width: 100%; - margin: 0; -} - -.daterangepicker td, .daterangepicker th { - text-align: center; - width: 20px; - height: 20px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - cursor: pointer; - white-space: nowrap; -} - -.daterangepicker td.off { - color: #999; -} - -.daterangepicker td.disabled, .daterangepicker option.disabled { - color: #999; -} - -.daterangepicker td.available:hover, .daterangepicker th.available:hover { - background: #eee; -} - -.daterangepicker td.in-range { - background: #ebf4f8; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} - -.daterangepicker td.active, .daterangepicker td.active:hover { - background-color: #006dcc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -ms-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(top, #0088cc, #0044cc); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); - border-color: #0044cc #0044cc #002a80; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); - color: #fff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} - -.daterangepicker td.week, .daterangepicker th.week { - font-size: 80%; - color: #ccc; -} - -.daterangepicker select.monthselect, .daterangepicker select.yearselect { - font-size: 12px; - padding: 1px; - height: auto; - margin: 0; - cursor: default; -} - -.daterangepicker select.monthselect { - margin-right: 2%; - width: 56%; -} - -.daterangepicker select.yearselect { - width: 40%; -} - -.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect { - width: 60px; - margin-bottom: 0; -} - -.daterangepicker_start_input { - float: left; -} - -.daterangepicker_end_input { - float: left; - padding-left: 11px -} - -.daterangepicker th.month { - width: auto; -} diff --git a/culturefeed_search_ui/css/daterangepicker-bs3.css b/culturefeed_search_ui/css/daterangepicker-bs3.css index c9c8fedf..6819a952 100644 --- a/culturefeed_search_ui/css/daterangepicker-bs3.css +++ b/culturefeed_search_ui/css/daterangepicker-bs3.css @@ -1,103 +1,41 @@ +/* */ +/* */ /*! - * Stylesheet for the Date Range Picker, for use with Bootstrap 3.x - * - * Copyright 2013-2015 Dan Grossman ( http://www.dangrossman.info ) - * Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php - * - * Built for http://www.improvely.com - */ - - .daterangepicker.dropdown-menu { +* Stylesheet for the Date Range Picker, for use with Bootstrap 3.x +* +* Copyright 2013-2015 Dan Grossman ( http://www.dangrossman.info ) +* Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php +* +* Built for http://www.improvely.com +*/ +.daterangepicker.dropdown-menu { max-width: none; z-index: 3000; } - -.daterangepicker.opensleft .ranges, .daterangepicker.opensleft .calendar { - float: left; - margin: 4px; +.daterangepicker .ranges .range_inputs .btn-block { + clear: both; + position: relative; } - -.daterangepicker.opensright .ranges, .daterangepicker.opensright .calendar, -.daterangepicker.openscenter .ranges, .daterangepicker.openscenter .calendar { - float: right; - margin: 4px; -} - -.daterangepicker.single .ranges, .daterangepicker.single .calendar { - float: none; -} - -.daterangepicker .ranges { - width: 160px; - text-align: left; -} - -.daterangepicker .ranges .range_inputs>div { - float: left; -} - -.daterangepicker .ranges .range_inputs>div:nth-child(2) { - padding-left: 11px; -} - .daterangepicker .calendar { display: none; - max-width: 270px; } - .daterangepicker.show-calendar .calendar { - display: block; + display: block; } - .daterangepicker .calendar.single .calendar-date { border: none; } - -.daterangepicker .calendar th, .daterangepicker .calendar td { - font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; +.daterangepicker .calendar th, +.daterangepicker .calendar td { white-space: nowrap; text-align: center; min-width: 32px; } - -.daterangepicker .daterangepicker_start_input label, -.daterangepicker .daterangepicker_end_input label { - color: #333; - display: block; - font-size: 11px; - font-weight: normal; - height: 20px; - line-height: 20px; - margin-bottom: 2px; - text-shadow: #fff 1px 1px 0px; - text-transform: uppercase; - width: 74px; -} - -.daterangepicker .ranges input { - font-size: 11px; -} - -.daterangepicker .ranges .input-mini { - border: 1px solid #ccc; - border-radius: 4px; - color: #555; - display: block; - font-size: 11px; - height: 30px; - line-height: 30px; - vertical-align: middle; - margin: 0 0 10px 0; - padding: 0 6px; - width: 74px; -} - .daterangepicker .ranges ul { list-style: none; margin: 0; padding: 0; } - .daterangepicker .ranges li { font-size: 13px; background: #f5f5f5; @@ -110,210 +48,104 @@ border-radius: 5px; cursor: pointer; } - -.daterangepicker .ranges li.active, .daterangepicker .ranges li:hover { +.daterangepicker .ranges li.active, +.daterangepicker .ranges li:hover { background: #08c; border: 1px solid #08c; color: #fff; } - .daterangepicker .calendar-date { border: 1px solid #ddd; padding: 4px; - border-radius: 4px; + border-radius: 1px; background: #fff; } - .daterangepicker .calendar-time { text-align: center; margin: 8px auto 0 auto; line-height: 30px; } - .daterangepicker { position: absolute; - background: #fff; top: 100px; left: 20px; - padding: 4px; + padding: 15px; margin-top: 1px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} - -.daterangepicker.opensleft:before { - position: absolute; - top: -7px; - right: 9px; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; -} - -.daterangepicker.opensleft:after { - position: absolute; - top: -6px; - right: 10px; - display: inline-block; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-left: 6px solid transparent; - content: ''; -} - -.daterangepicker.openscenter:before { - position: absolute; - top: -7px; - left: 0; - right: 0; - width: 0; - margin-left: auto; - margin-right: auto; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; -} - -.daterangepicker.openscenter:after { - position: absolute; - top: -6px; - left: 0; - right: 0; - width: 0; - margin-left: auto; - margin-right: auto; - display: inline-block; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-left: 6px solid transparent; - content: ''; -} - -.daterangepicker.opensright:before { - position: absolute; - top: -7px; - left: 9px; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; -} - -.daterangepicker.opensright:after { - position: absolute; - top: -6px; - left: 10px; - display: inline-block; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-left: 6px solid transparent; - content: ''; + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; + background-color: #F3F3F3; } - .daterangepicker table { width: 100%; margin: 0; } - -.daterangepicker td, .daterangepicker th { +.daterangepicker td, +.daterangepicker th { text-align: center; width: 20px; height: 20px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; cursor: pointer; white-space: nowrap; } - .daterangepicker td.off { color: #999; } - -.daterangepicker td.disabled, .daterangepicker option.disabled { +.daterangepicker td.disabled, +.daterangepicker option.disabled { color: #999; } - -.daterangepicker td.available:hover, .daterangepicker th.available:hover { +.daterangepicker td.available:hover, +.daterangepicker th.available:hover { background: #eee; } - .daterangepicker td.in-range { - background: #ebf4f8; + background: #c7e5ff; -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0; } - -.daterangepicker td.start-date { - -webkit-border-radius: 4px 0 0 4px; - -moz-border-radius: 4px 0 0 4px; - border-radius: 4px 0 0 4px; -} - -.daterangepicker td.end-date { - -webkit-border-radius: 0 4px 4px 0; - -moz-border-radius: 0 4px 4px 0; - border-radius: 0 4px 4px 0; -} - .daterangepicker td.start-date.end-date { - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; } - -.daterangepicker td.active, .daterangepicker td.active:hover { - background-color: #357ebd; +.daterangepicker td.active, +.daterangepicker td.active:hover { + background-color: #004f94; border-color: #3071a9; color: #fff; } - -.daterangepicker td.week, .daterangepicker th.week { +.daterangepicker td.week, +.daterangepicker th.week { font-size: 80%; color: #ccc; } - -.daterangepicker select.monthselect, .daterangepicker select.yearselect { +.daterangepicker select.monthselect, +.daterangepicker select.yearselect { font-size: 12px; padding: 1px; height: auto; margin: 0; cursor: default; } - .daterangepicker select.monthselect { margin-right: 2%; width: 56%; } - .daterangepicker select.yearselect { width: 40%; } - -.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect { +.daterangepicker select.hourselect, +.daterangepicker select.minuteselect, +.daterangepicker select.secondselect, +.daterangepicker select.ampmselect { width: 50px; margin-bottom: 0; } - -.daterangepicker_start_input { - float: left; -} - -.daterangepicker_end_input { - float: left; - padding-left: 11px -} - .daterangepicker th.month { width: auto; } diff --git a/culturefeed_search_ui/culturefeed_search_ui.module b/culturefeed_search_ui/culturefeed_search_ui.module index 1573b665..76f3fcc3 100644 --- a/culturefeed_search_ui/culturefeed_search_ui.module +++ b/culturefeed_search_ui/culturefeed_search_ui.module @@ -329,7 +329,7 @@ function culturefeed_search_ui_library() { $libraries['ui.moment'] = array( 'title' => 'Moment.js', 'website' => 'http://momentjs.com/', - 'version' => '2.9.0', + 'version' => '2.8.1', 'js' => array( $path . '/js/moment.min.js' => array(), ), @@ -339,7 +339,7 @@ function culturefeed_search_ui_library() { $libraries['ui.daterangepicker'] = array( 'title' => 'Date Range Picker', 'website' => 'http://www.daterangepicker.com/', - 'version' => '1.3.19+master', + 'version' => '1.3.17', 'js' => array( $path . '/js/daterangepicker.js' => array(), ), diff --git a/culturefeed_search_ui/js/daterangepicker.js b/culturefeed_search_ui/js/daterangepicker.js index dae63e68..7e11af3a 100644 --- a/culturefeed_search_ui/js/daterangepicker.js +++ b/culturefeed_search_ui/js/daterangepicker.js @@ -1,11 +1,14 @@ /** -* @version: 1.3.19 +* @version: 1.3.17 * @author: Dan Grossman http://www.dangrossman.info/ -* @copyright: Copyright (c) 2012-2015 Dan Grossman. All rights reserved. +* @date: 2014-11-25 +* @copyright: Copyright (c) 2012-2014 Dan Grossman. All rights reserved. * @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php -* @website: https://www.improvely.com/ +* @website: http://www.improvely.com/ */ +/* TEMPLATE */ + (function(root, factory) { if (typeof define === 'function' && define.amd) { @@ -44,23 +47,42 @@ this.isShowing = false; //create the picker HTML object - var DRPTemplate = '