events js: pass only first line of desc as title; item.desc and item.location as html

This commit is contained in:
Fabio Comuni 2012-02-14 16:48:34 +01:00
parent 549c920e6f
commit 7140e56d1f

View file

@ -241,10 +241,8 @@ function events_content(&$a) {
$start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c')); $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c'));
if ($rr['nofinish']){ if ($rr['nofinish']){
$end = null; $end = null;
$allday=true;
} else { } else {
$end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c')); $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c'));
$allday=false;
} }
@ -253,26 +251,31 @@ function events_content(&$a) {
$last_date = $d; $last_date = $d;
$edit = ((! $rr['cid']) ? array($a->get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null); $edit = ((! $rr['cid']) ? array($a->get_baseurl().'/events/event/'.$rr['id'],t('Edit event'),'','') : null);
list($title, $_trash) = explode("<br",bbcode($rr['desc']),2);
$title = strip_tags($title);
$html = format_event_html($rr);
$rr['desc'] = bbcode($rr['desc']);
$rr['location'] = bbcode($rr['location']);
$events[] = array( $events[] = array(
'id'=>$rr['id'], 'id'=>$rr['id'],
'start'=> $start, 'start'=> $start,
'end' => $end, 'end' => $end,
'allDay' => $allday, 'allDay' => false,
'title' => strip_tags(bbcode($rr['desc'])), 'title' => $title,
'j' => $j, 'j' => $j,
'd' => $d, 'd' => $d,
'edit' => $edit, 'edit' => $edit,
'is_first'=>$is_first, 'is_first'=>$is_first,
'item'=>$rr, 'item'=>$rr,
'html'=>format_event_html($rr), 'html'=>$html,
'plink' => array($rr['plink'],t('link to source'),'',''), 'plink' => array($rr['plink'],t('link to source'),'',''),
); );
} }
} }
if ($a->argv[1] === 'json'){ if ($a->argv[1] === 'json'){
echo json_encode($events); killme(); echo json_encode($events); killme();
} }