From 974e41aa4b3fc68b65a5162707047060baeed252 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 8 Nov 2010 18:14:13 -0500 Subject: change to a table for HTML output --- plugins/EmailSummary/useremailsummaryhandler.php | 350 ++++------------------- 1 file changed, 54 insertions(+), 296 deletions(-) (limited to 'plugins') diff --git a/plugins/EmailSummary/useremailsummaryhandler.php b/plugins/EmailSummary/useremailsummaryhandler.php index 9ef56a20d..1ac1eaedb 100644 --- a/plugins/EmailSummary/useremailsummaryhandler.php +++ b/plugins/EmailSummary/useremailsummaryhandler.php @@ -124,17 +124,66 @@ class UserEmailSummaryHandler extends QueueHandler $out = new XMLStringer(); - $out->raw(''); - $out->raw(sprintf(_('

Recent updates from %1s for %2s:

'), common_config('site', 'name'), $profile->getBestName())); - $nl = new NoticeList($notice, $out); - // Outputs to the string + $out->elementStart('table', array('width' => '100%', 'style' => 'border: none')); - $nl->show(); + while ($notice->fetch()) { + + $profile = Profile::staticGet('id', $notice->profile_id); + + if (empty($profile)) { + continue; + } + + $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE); + + $out->elementStart('tr'); + $out->elementStart('td'); + $out->element('img', array('src' => ($avatar) ? + $avatar->displayUrl() : + Avatar::defaultImage($avatar_size), + 'class' => 'avatar photo', + 'width' => $avatar_size, + 'height' => $avatar_size, + 'alt' => $profile->getBestName())); + $out->elementEnd('td'); + $out->elementStart('td'); + $out->element('a', array('href' => $profile->profileurl), + $profile->nickname); + $out->text(' '); + $out->raw($notice->rendered); + $out->element('br'); // yeah, you know it. I just wrote a
in the middle of my table layout. + $noticeurl = $notice->bestUrl(); + // above should always return an URL + assert(!empty($noticeurl)); + $out->elementStart('a', array('rel' => 'bookmark', + 'class' => 'timestamp', + 'href' => $noticeurl)); + $dt = common_date_iso8601($notice->created); + $out->element('abbr', array('class' => 'published', + 'title' => $dt), + common_date_string($notice->created)); + $out->elementEnd('a'); + if ($notice->hasConversation()) { + $conv = Conversation::staticGet('id', $notice->conversation); + $convurl = $conv->uri; + if (!empty($convurl)) { + $out->text(' '); + $out->element('a', + array('href' => $convurl.'#notice-'.$notice->id, + 'class' => 'response'), + _('in context')); + } + } + $out->elementEnd('td'); + $out->elementEnd('tr'); + } + + $out->elementEnd('table'); $out->raw(sprintf(_('

change your email settings for %2s

'), common_local_url('emailsettings'), @@ -170,295 +219,4 @@ class UserEmailSummaryHandler extends QueueHandler return true; } - - function stylesheet() - { - $ss = <<