function showContent()
 {
     $notice = $this->nli->notice;
     $out = $this->nli->out;
     $entry = Blog_entry::fromNotice($notice);
     if (empty($entry)) {
         throw new Exception('BlogEntryListItem used for non-blog notice.');
     }
     $out->elementStart('h4', array('class' => 'blog-entry-title'));
     $out->element('a', array('href' => $notice->bestUrl()), $entry->title);
     $out->elementEnd('h4');
     // XXX: kind of a hack
     $actionName = $out->trimmed('action');
     if ($actionName == 'shownotice' || $actionName == 'showblogentry' || $actionName == 'conversation') {
         $out->elementStart('div', 'blog-entry-content');
         $out->raw($entry->content);
         $out->elementEnd('div');
     } else {
         if (!empty($entry->summary)) {
             $out->elementStart('div', 'blog-entry-summary');
             $out->raw($entry->summary);
             $out->elementEnd('div');
         }
         $url = $entry->url ? $entry->url : $notice->bestUrl();
         $out->element('a', array('href' => $url, 'class' => 'blog-entry-link'), _('More...'));
     }
 }
 function getNotice()
 {
     $this->id = $this->trimmed('id');
     $this->entry = Blog_entry::staticGet('id', $this->id);
     if (empty($this->entry)) {
         // TRANS: Client exception thrown when referring to a non-existing blog entry.
         throw new ClientException(_m('No such entry.'), 404);
     }
     $notice = $this->entry->getNotice();
     if (empty($notice)) {
         // TRANS: Client exception thrown when referring to a non-existing blog entry.
         throw new ClientException(_m('No such entry.'), 404);
     }
     return $notice;
 }
 function showContent()
 {
     $notice = $this->nli->notice;
     $out = $this->nli->out;
     $entry = Blog_entry::fromNotice($notice);
     if (empty($entry)) {
         throw new Exception('BlogEntryListItem used for non-blog notice.');
     }
     $out->elementStart('h4', array('class' => 'blog-entry-title'));
     $out->element('a', array('href' => $notice->bestUrl()), $entry->title);
     $out->elementEnd('h4');
     if (!empty($entry->summary)) {
         $out->elementStart('div', 'blog-entry-summary');
         $out->raw($entry->summary);
         $out->elementEnd('div');
     } else {
         // XXX: hide content initially; click More... for full text.
         $out->elementStart('div', 'blog-entry-content');
         $out->raw($entry->content);
         $out->elementEnd('div');
     }
 }
 function deleteRelated($notice)
 {
     if ($notice->object_type == Blog_entry::TYPE) {
         $entry = Blog_entry::fromNotice($notice);
         if (exists($entry)) {
             $entry->delete();
         }
     }
 }
 static function fromNotice($notice)
 {
     return Blog_entry::staticGet('uri', $notice->uri);
 }
Exemple #6
0
 /**
  * Handler method
  *
  * @param array $argarray is ignored since it's now passed in in prepare()
  *
  * @return void
  */
 function handle($argarray = null)
 {
     $options = array();
     // Does the heavy-lifting for getting "To:" information
     ToSelector::fillOptions($this, $options);
     $options['source'] = 'web';
     $profile = $this->user->getProfile();
     $saved = Blog_entry::saveNew($profile, $this->title, $this->content, $options);
     if ($this->boolean('ajax')) {
         header('Content-Type: text/xml; charset=utf-8');
         $this->xw->startDocument('1.0', 'UTF-8');
         $this->elementStart('html');
         $this->elementStart('head');
         // TRANS: Page title after sending a notice.
         $this->element('title', null, _m('Blog entry saved'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $nli = new NoticeListItem($saved, $this);
         $nli->show();
         $this->elementEnd('body');
         $this->elementEnd('html');
     } else {
         common_redirect($saved->bestUrl(), 303);
     }
 }