From c7cbd41c16e36a6244ada6d4317dcd390e8dde0d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 26 Nov 2015 12:26:27 +0100 Subject: first iteration on the event item --- include/ItemObject.php | 1 + include/conversation.php | 1 + include/event.php | 5 ++++ include/text.php | 51 ++++++++++++++++++++++++++++++++++++++- view/css/conversation.css | 3 +-- view/theme/redbasic/css/style.css | 13 ++++++++-- view/tpl/conv_item.tpl | 5 ++++ view/tpl/conv_list.tpl | 5 ++++ view/tpl/search_item.tpl | 5 ++++ 9 files changed, 84 insertions(+), 5 deletions(-) diff --git a/include/ItemObject.php b/include/ItemObject.php index 512e12838..8be99d91e 100644 --- a/include/ItemObject.php +++ b/include/ItemObject.php @@ -346,6 +346,7 @@ class Item extends BaseObject { 'owner_photo' => $this->get_owner_photo(), 'owner_name' => $this->get_owner_name(), 'photo' => $body['photo'], + 'event' => $body['event'], 'has_tags' => $has_tags, // Item toolbar buttons diff --git a/include/conversation.php b/include/conversation.php index 2c447acbc..3b534dc69 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -697,6 +697,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ 'thumb' => $profile_avatar, 'title' => $item['title'], 'body' => $body['html'], + 'event' => $body['event'], 'photo' => $body['photo'], 'tags' => $body['tags'], 'categories' => $body['categories'], diff --git a/include/event.php b/include/event.php index 9d111ca25..c82699eff 100644 --- a/include/event.php +++ b/include/event.php @@ -787,6 +787,11 @@ function event_store_item($arr, $event) { 'type' => ACTIVITY_OBJ_EVENT, 'id' => z_root() . '/event/' . $r[0]['resource_id'], 'title' => $arr['summary'], + 'start' => $arr['start'], + 'finish' => $arr['finish'], + 'description' => $arr['description'], + 'location' => $arr['location'], + 'adjust' => $arr['adjust'], 'content' => format_event_bbcode($arr), 'author' => array( 'name' => $r[0]['xchan_name'], diff --git a/include/text.php b/include/text.php index eb9171b40..f40d67f23 100644 --- a/include/text.php +++ b/include/text.php @@ -5,6 +5,7 @@ require_once("include/template_processor.php"); require_once("include/smarty.php"); +require_once("include/bbcode.php"); // random string, there are 86 characters max in text mode, 128 for hex // output is urlsafe @@ -1413,9 +1414,55 @@ function prepare_body(&$item,$attach = false) { } } + $event = array(); + $is_event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? true : false); + + if($is_event) { + $object = json_decode($item['object'],true); + + //ensure compatibility with older items + if(array_key_exists('description', $object)) { + + $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8:01 AM + + $event['header'] = '

 ' . bbcode($object['title']) . '

' . "\r\n"; + + $event['header'] .= '
' . t('Starts:') . ' ' + . (($object['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), + $object['start'] , $bd_format )) + : day_translate(datetime_convert('UTC', 'UTC', + $object['start'] , $bd_format))) + . '
' . "\r\n"; + + if(! $object['nofinish']) + $event['header'] .= '
' . t('Finishes:') . ' ' + . (($object['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), + $object['finish'] , $bd_format )) + : day_translate(datetime_convert('UTC', 'UTC', + $object['finish'] , $bd_format ))) + . '
' . "\r\n"; + + + $event['content'] = '
' . bbcode($object['description']) . '
' . "\r\n"; + + if(strlen($object['location'])) + $event['content'] .= '
' . t('Location:') . ' ' + . bbcode($object['location']) + . '
' . "\r\n"; + } + else { + $is_event = false; + } + } + $prep_arr = array( 'item' => $item, - 'html' => $s, + 'html' => $is_event ? $event['content'] : $s, + 'event' => $event['header'], 'photo' => $photo ); @@ -1423,6 +1470,7 @@ function prepare_body(&$item,$attach = false) { $s = $prep_arr['html']; $photo = $prep_arr['photo']; + $event = $prep_arr['event']; // q("update item set html = '%s' where id = %d", // dbesc($s), @@ -1489,6 +1537,7 @@ function prepare_body(&$item,$attach = false) { 'item' => $item, 'photo' => $photo, 'html' => $s, + 'event' => $event, 'categories' => $categories, 'folders' => $filer, 'tags' => $tags, diff --git a/view/css/conversation.css b/view/css/conversation.css index 6a64e7cc2..24a22defb 100644 --- a/view/css/conversation.css +++ b/view/css/conversation.css @@ -249,11 +249,10 @@ a.wall-item-name-link { /* event item */ .event-title h3 { + margin: 0px 0px 10px 0px; font-weight: bold; } -.event-title, -.event-end, .event-description { padding-bottom: 10px; } diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 357bb5093..f9aca1f59 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -857,6 +857,15 @@ nav .acpopup { border-color: #ccc !important; } +.wall-event-item { + padding: 10px; + color: #fff; + background-color: #3A87AD; /* should reflect calendar color */ + border-top-left-radius: $radiuspx; + border-top-right-radius: $radiuspx; +} + + #event-summary-text { margin-top: 15px; } @@ -1242,14 +1251,14 @@ a.rconnect:hover, a.rateme:hover, div.rateme:hover { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -/* display: block; */ + display: block; } .dropdown-sub-text { line-height: 1em; overflow: hidden; text-overflow: ellipsis; -/* display: block; */ + display: block; } .notify-seen a { diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl index 5257b3ed6..206ee245e 100755 --- a/view/tpl/conv_item.tpl +++ b/view/tpl/conv_item.tpl @@ -13,6 +13,11 @@ {{$item.photo}} {{/if}} + {{if $item.event}} +
+ {{$item.event}} +
+ {{/if}}
diff --git a/view/tpl/conv_list.tpl b/view/tpl/conv_list.tpl index 53f65bc78..cf1310ea6 100755 --- a/view/tpl/conv_list.tpl +++ b/view/tpl/conv_list.tpl @@ -13,6 +13,11 @@ {{$item.photo}}
{{/if}} + {{if $item.event}} +
+ {{$item.event}} +
+ {{/if}}
diff --git a/view/tpl/search_item.tpl b/view/tpl/search_item.tpl index b44e1c39e..b2689c7ba 100755 --- a/view/tpl/search_item.tpl +++ b/view/tpl/search_item.tpl @@ -7,6 +7,11 @@ {{$item.photo}}
{{/if}} + {{if $item.event}} +
+ {{$item.event}} +
+ {{/if}}
-- cgit v1.2.3 From f80aff4a65fcd4318e269aad41593e18bfb145a4 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 26 Nov 2015 13:28:31 +0100 Subject: also catch the other object --- include/event.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/event.php b/include/event.php index c82699eff..a3765a145 100644 --- a/include/event.php +++ b/include/event.php @@ -931,6 +931,11 @@ function event_store_item($arr, $event) { 'type' => ACTIVITY_OBJ_EVENT, 'id' => z_root() . '/event/' . $event['event_hash'], 'title' => $arr['summary'], + 'start' => $arr['start'], + 'finish' => $arr['finish'], + 'description' => $arr['description'], + 'location' => $arr['location'], + 'adjust' => $arr['adjust'], 'content' => format_event_bbcode($arr), 'author' => array( 'name' => $x[0]['xchan_name'], -- cgit v1.2.3 From 306ce3819ebdf761085b9a1247f62e01bf4c5adf Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 26 Nov 2015 14:16:35 +0100 Subject: css fixes --- view/css/conversation.css | 1 + view/theme/redbasic/css/style.css | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/view/css/conversation.css b/view/css/conversation.css index 24a22defb..26478aa9c 100644 --- a/view/css/conversation.css +++ b/view/css/conversation.css @@ -253,6 +253,7 @@ a.wall-item-name-link { font-weight: bold; } +.event-end, .event-description { padding-bottom: 10px; } diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index f9aca1f59..91e684aaa 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -858,7 +858,7 @@ nav .acpopup { } .wall-event-item { - padding: 10px; + padding: 10px 10px 0px 10px; color: #fff; background-color: #3A87AD; /* should reflect calendar color */ border-top-left-radius: $radiuspx; -- cgit v1.2.3 From 17e7b276f6c647bc65cb34dfcb1c395e528ef8a3 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 26 Nov 2015 14:45:22 +0100 Subject: we also need nofinish in the object. css fices --- include/event.php | 2 ++ view/css/conversation.css | 1 - view/theme/redbasic/css/style.css | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/event.php b/include/event.php index a3765a145..539bfe484 100644 --- a/include/event.php +++ b/include/event.php @@ -789,6 +789,7 @@ function event_store_item($arr, $event) { 'title' => $arr['summary'], 'start' => $arr['start'], 'finish' => $arr['finish'], + 'nofinish' => $arr['nofinish'], 'description' => $arr['description'], 'location' => $arr['location'], 'adjust' => $arr['adjust'], @@ -933,6 +934,7 @@ function event_store_item($arr, $event) { 'title' => $arr['summary'], 'start' => $arr['start'], 'finish' => $arr['finish'], + 'nofinish' => $arr['nofinish'], 'description' => $arr['description'], 'location' => $arr['location'], 'adjust' => $arr['adjust'], diff --git a/view/css/conversation.css b/view/css/conversation.css index 26478aa9c..24a22defb 100644 --- a/view/css/conversation.css +++ b/view/css/conversation.css @@ -253,7 +253,6 @@ a.wall-item-name-link { font-weight: bold; } -.event-end, .event-description { padding-bottom: 10px; } diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 91e684aaa..fe6f10365 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -858,13 +858,16 @@ nav .acpopup { } .wall-event-item { - padding: 10px 10px 0px 10px; + padding: 10px; color: #fff; background-color: #3A87AD; /* should reflect calendar color */ border-top-left-radius: $radiuspx; border-top-right-radius: $radiuspx; } +.vevent .event-end { + padding-bottom: 10px; +} #event-summary-text { margin-top: 15px; -- cgit v1.2.3 From 8e3b796a2ff28d1c46fbae9d2b029e9f7252c0dc Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 26 Nov 2015 16:38:14 +0100 Subject: fix event rendering --- view/tpl/event_head.tpl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/view/tpl/event_head.tpl b/view/tpl/event_head.tpl index ec43d7ab7..05d58aba2 100755 --- a/view/tpl/event_head.tpl +++ b/view/tpl/event_head.tpl @@ -64,34 +64,35 @@ }, eventRender: function(event, element, view) { + //console.log(view.name); if (event.item['author']['xchan_name']==null) return; switch(view.name){ case "month": - element.find(".fc-event-title").html( - "{1} : {2}".format( + element.find(".fc-title").html( + " {1}: {2}".format( event.item['author']['xchan_photo_s'], event.item['author']['xchan_name'], event.title )); break; case "agendaWeek": - element.find(".fc-event-title").html( - "{1}

{2}

{3}

".format( + element.find(".fc-title").html( + " {1}: {2}

{3}

".format( event.item['author']['xchan_photo_s'], event.item['author']['xchan_name'], - event.item.desc, - event.item.location + event.title, + event.item.description )); break; case "agendaDay": - element.find(".fc-event-title").html( - "{1}

{2}

{3}

".format( + element.find(".fc-title").html( + " {1}: {2}

{3}

".format( event.item['author']['xchan_photo_s'], event.item['author']['xchan_name'], - event.item.desc, - event.item.location + event.title, + event.item.description )); break; } -- cgit v1.2.3 From c407e72dcc4d4f892e88e8260e662104586695f2 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 26 Nov 2015 16:40:40 +0100 Subject: add location --- view/tpl/event_head.tpl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/view/tpl/event_head.tpl b/view/tpl/event_head.tpl index 05d58aba2..4362360d3 100755 --- a/view/tpl/event_head.tpl +++ b/view/tpl/event_head.tpl @@ -79,20 +79,22 @@ break; case "agendaWeek": element.find(".fc-title").html( - " {1}: {2}

{3}

".format( + " {1}: {2}

{3}

{4}

".format( event.item['author']['xchan_photo_s'], event.item['author']['xchan_name'], event.title, - event.item.description + event.item.description, + event.item.location )); break; case "agendaDay": element.find(".fc-title").html( - " {1}: {2}

{3}

".format( + " {1}: {2}

{3}

{4}

".format( event.item['author']['xchan_photo_s'], event.item['author']['xchan_name'], event.title, - event.item.description + event.item.description, + event.item.location )); break; } -- cgit v1.2.3