some fixes related to events

- add backticks around column "desc" in sql query
    - fixed query for data passed to showEvent
      - showEvent was picking up on id from item instead of id from event
    - fixed references to author info in template
This commit is contained in:
Michael Johnston 2013-03-07 02:05:19 -05:00
parent 863dcda8ee
commit 41cd10f903
4 changed files with 8 additions and 7 deletions

View File

@ -332,7 +332,7 @@ function event_store($arr) {
$arr['uri'] = item_message_id(); $arr['uri'] = item_message_id();
$r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary, desc,location,type, $r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary, `desc`,location,type,
adjust,nofinish,allow_cid,allow_gid,deny_cid,deny_gid) adjust,nofinish,allow_cid,allow_gid,deny_cid,deny_gid)
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ", VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
intval($arr['uid']), intval($arr['uid']),

View File

@ -229,9 +229,9 @@ function events_content(&$a) {
$adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start); $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
$adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish); $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
if (x($_GET,'id')){ if (x($_GET,'id')){
$r = q("SELECT * from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d limit 1", $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan
from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d limit 1",
intval(local_user()), intval(local_user()),
intval($_GET['id']) intval($_GET['id'])
); );
@ -242,8 +242,8 @@ function events_content(&$a) {
// Noting this for now - it will need to be fixed here and in Friendica. // Noting this for now - it will need to be fixed here and in Friendica.
// Ultimately the finish date shouldn't be involved in the query. // Ultimately the finish date shouldn't be involved in the query.
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan
$r = q("SELECT * from event left join item on event_hash = resource_id from event left join item on event_hash = resource_id
where resource_type = 'event' and event.uid = %d and event.ignore = %d where resource_type = 'event' and event.uid = %d and event.ignore = %d
AND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish ) AND `start` <= '%s' ) AND (( `adjust` = 0 AND ( `finish` >= '%s' or nofinish ) AND `start` <= '%s' )
OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish ) AND `start` <= '%s' )) ", OR ( `adjust` = 1 AND ( `finish` >= '%s' or nofinish ) AND `start` <= '%s' )) ",
@ -339,6 +339,7 @@ function events_content(&$a) {
else { else {
$tpl = get_markup_template("events-js.tpl"); $tpl = get_markup_template("events-js.tpl");
} }
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),
'$tabs' => $tabs, '$tabs' => $tabs,

View File

@ -1,7 +1,7 @@
{{ for $events as $event }} {{ for $events as $event }}
<div class="event"> <div class="event">
{{ if $event.item.author-name }}<a href="$event.item.author-link" ><img src="$event.item.author-avatar" height="32" width="32" />$event.item.author-name</a>{{ endif }} {{ if $event.item.author.xchan_name }}<a href="$event.item.author.xchan_url" ><img src="$event.item.author.xchan_photo_s" height="32" width="32" />$event.item.author.xchan_name</a>{{ endif }}
$event.html $event.html
{{ if $event.item.plink }}<a href="$event.plink.0" title="$event.plink.1" class="plink-event-link icon s22 remote-link"></a>{{ endif }} {{ if $event.item.plink }}<a href="$event.plink.0" title="$event.plink.1" class="plink-event-link icon s22 remote-link"></a>{{ endif }}
{{ if $event.edit }}<a href="$event.edit.0" title="$event.edit.1" class="edit-event-link icon s22 pencil"></a>{{ endif }} {{ if $event.edit }}<a href="$event.edit.0" title="$event.edit.1" class="edit-event-link icon s22 pencil"></a>{{ endif }}

View File

@ -6,7 +6,7 @@
{{foreach $events as $event}} {{foreach $events as $event}}
<div class="event"> <div class="event">
{{if $event.item.author-name}}<a href="{{$event.item.author-link}}" ><img src="{{$event.item.author-avatar}}" height="32" width="32" />{{$event.item.author-name}}</a>{{/if}} {{if $event.item.author.xchan_name}}<a href="{{$event.item.author.xchan_url}}" ><img src="{{$event.item.author.xchan_photo_s}}" height="32" width="32" />{{$event.item.author.xchan_name}}</a>{{/if}}
{{$event.html}} {{$event.html}}
{{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" class="plink-event-link icon s22 remote-link"></a>{{/if}} {{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" class="plink-event-link icon s22 remote-link"></a>{{/if}}
{{if $event.edit}}<a href="{{$event.edit.0}}" title="{{$event.edit.1}}" class="edit-event-link icon s22 pencil"></a>{{/if}} {{if $event.edit}}<a href="{{$event.edit.0}}" title="{{$event.edit.1}}" class="edit-event-link icon s22 pencil"></a>{{/if}}