Example #1
0
 protected function displayAuthor(BlorgAuthor $author)
 {
     $view = SiteViewFactory::get($this->app, 'author');
     $view->setPartMode('name', SiteView::MODE_SUMMARY);
     $view->setPartMode('bodytext', SiteView::MODE_NONE);
     $view->setPartMode('email', SiteView::MODE_NONE);
     $view->setPartMode('description', SiteView::MODE_ALL, false);
     $view->setPartMode('post_count', SiteView::MODE_NONE, false);
     $view->display($author);
 }
Example #2
0
 protected function getView()
 {
     $view = SiteViewFactory::get($this->app, 'building-block');
     // configure views for display in list
     $view->getImageView()->setImageDimensionShortname('thumb');
     $view->getXHTMLView()->setBodySummaryLength(200);
     $view->getXHTMLView()->setPartMode('body', SiteView::MODE_SUMMARY);
     // don't link attachments
     $view->getAttachmentView()->setPartMode('content', SiteView::MODE_ALL, false);
     return $view;
 }
Example #3
0
 protected function getView()
 {
     if ($this->view === null && $this->app !== null) {
         $this->view = SiteViewFactory::get($this->app, 'post-comment');
         $this->view->setPartMode('bodytext', SiteView::MODE_SUMMARY);
         $this->view->setPartMode('permalink', SiteView::MODE_ALL, false);
         $this->view->setPartMode('author', SiteView::MODE_ALL, false);
         $this->view->setPartMode('link', SiteView::MODE_ALL, false);
     }
     return $this->view;
 }
Example #4
0
 protected function buildInternal()
 {
     parent::buildInternal();
     $item_list = $this->getItemList('integer');
     $blocks = SwatDB::query($this->app->db, sprintf('select * from Block where id in (%s)', $this->getItemList('integer')), SwatDBClassMap::get('BuildingBlockWrapper'));
     $view = SiteViewFactory::get($this->app, 'building-block');
     $view->getImageView()->setImageDimensionShortname('thumb');
     ob_start();
     $header = new SwatHtmlTag('h1');
     $header->setContent('Delete the following content?');
     $header->display();
     foreach ($blocks as $block) {
         $view->display($block);
     }
     $message = $this->ui->getWidget('confirmation_message');
     $message->content = ob_get_clean();
     $message->content_type = 'text/xml';
 }
Example #5
0
        return $path . '/' . $tag->shortname;
    }
    // }}}
    // {{{ public static function getAuthorRelativeUri()
    public static function getAuthorRelativeUri(SiteApplication $app, BlorgAuthor $author)
    {
        $path = $app->config->blorg->path . 'author';
        return $path . '/' . $author->shortname;
    }
    // }}}
    // {{{ public static function getCommentRelativeUri()
    public static function getCommentRelativeUri(SiteApplication $app, SiteComment $comment)
    {
        return Blorg::getPostRelativeUri($app, $comment->post) . '#comment' . $comment->id;
    }
    // }}}
    // {{{ private function __construct()
    /**
     * Prevent instantiation of this static class
     */
    private function __construct()
    {
    }
}
Blorg::setupGettext();
SwatUI::mapClassPrefixToPath('Blorg', 'Blorg');
SiteViewFactory::addPath('Blorg/views');
SiteViewFactory::registerView('post', 'BlorgPostView');
SiteViewFactory::registerView('post-comment', 'BlorgCommentView');
SiteViewFactory::registerView('author', 'BlorgAuthorView');
SiteGadgetFactory::addPath('Blorg/gadgets');
Example #6
0
 protected function displayComments()
 {
     if ($this->post->comment_status != SiteCommentStatus::CLOSED) {
         Blorg::displayAd($this->app, 'post_comments');
         $div_tag = new SwatHtmlTag('div');
         $div_tag->id = 'comments';
         $div_tag->class = 'entry-comments';
         $div_tag->open();
         $comments = $this->post->getVisibleComments();
         $view = SiteViewFactory::get($this->app, 'post-comment');
         $count = count($comments);
         if ($count > 0) {
             echo '<h3 class="comments-title">', Blorg::_('Comments'), '</h3>';
         }
         // display message for locked comments
         if ($this->post->comment_status == SiteCommentStatus::LOCKED) {
             $div_tag = new SwatHtmlTag('div');
             $div_tag->class = 'comments-locked-message';
             $div_tag->setContent(Blorg::_('Comments are locked. No additional comments may be ' . 'posted.'));
             $div_tag->display();
         }
         foreach ($comments as $i => $comment) {
             if ($i == $count - 1) {
                 $div_tag = new SwatHtmlTag('div');
                 $div_tag->id = 'last_comment';
                 $div_tag->open();
                 $view->display($comment);
                 $div_tag->close();
             } else {
                 $view->display($comment);
             }
         }
         $div_tag->close();
     }
 }
Example #7
0
 protected function displayPosts()
 {
     $view = SiteViewFactory::get($this->app, 'post');
     $view->setPartMode('extended_bodytext', SiteView::MODE_SUMMARY);
     $first = true;
     foreach ($this->posts as $post) {
         if ($first) {
             $first_div = new SwatHtmlTag('div');
             $first_div->class = 'entry-first';
             $first_div->open();
             $view->display($post);
             $first_div->close();
             $first = false;
         } else {
             $view->display($post);
         }
     }
 }
Example #8
0
    // {{{ public static function setupGettext()
    public static function setupGettext()
    {
        $path = '@DATA-DIR@/Building/locale';
        if (substr($path, 0, 1) === '@') {
            $path = __DIR__ . '/../locale';
        }
        bindtextdomain(self::GETTEXT_DOMAIN, $path);
        bind_textdomain_codeset(self::GETTEXT_DOMAIN, 'UTF-8');
    }
    // }}}
    // {{{ private function __construct()
    /**
     * Don't allow instantiation of the Building object
     *
     * This class contains only static methods and should not be instantiated.
     */
    private function __construct()
    {
    }
}
Building::setupGettext();
SiteViewFactory::addPath('Building/views');
SiteViewFactory::registerView('building-block-audio', 'BuildingBlockAudioView');
SiteViewFactory::registerView('building-block-video', 'BuildingBlockVideoView');
SiteViewFactory::registerView('building-block-image', 'BuildingBlockImageView');
SiteViewFactory::registerView('building-block-xhtml', 'BuildingBlockXHTMLView');
SiteViewFactory::registerView('building-block-attachment', 'BuildingBlockAttachmentView');
SiteViewFactory::registerView('building-block', 'BuildingBlockCompositeView');
SiteViewFactory::registerView('building-block-admin', 'BuildingBlockAdminCompositeView');
SwatUI::mapClassPrefixToPath('Building', 'Building');
 protected function createCompositeViewForType($type)
 {
     return SiteViewFactory::get($this->app, $type);
 }
Example #10
0
 protected function getPostView()
 {
     $view = SiteViewFactory::get($this->app, 'post');
     $view->setPathPrefix('../');
     $view->setPartLink('author', false);
     $view->setPartLink('title', false);
     $view->setPartLink('permalink', false);
     $view->setPartLink('comment_count', false);
     $view->setPartLink('extended_bodytext', false);
     $view->setPartLink('author', false);
     return $view;
 }
Example #11
0
 protected function getView()
 {
     return SiteViewFactory::get($this->app, 'photo-comment');
 }
Example #12
0
 protected function displayMonths()
 {
     $path = $this->app->config->blorg->path . 'archive';
     $view = SiteViewFactory::get($this->app, 'post');
     $view->setPartMode('title', SiteView::MODE_SUMMARY);
     $view->setPartMode('bodytext', SiteView::MODE_NONE);
     $view->setPartMode('extended_bodytext', SiteView::MODE_NONE);
     $view->setPartMode('tags', SiteView::MODE_NONE);
     $view->setPartMode('files', SiteView::MODE_NONE);
     $ul_tag = new SwatHtmlTag('ul');
     $ul_tag->class = 'blorg-archive-months';
     $ul_tag->open();
     foreach ($this->months as $month => $posts) {
         $li_tag = new SwatHtmlTag('li');
         $li_tag->open();
         $heading_tag = new SwatHtmlTag('h4');
         $heading_tag->class = 'blorg-archive-month-title';
         $heading_tag->open();
         $date = new SwatDate();
         $date->setDate(2010, $month, 1);
         $anchor_tag = new SwatHtmlTag('a');
         $anchor_tag->href = sprintf('%s/%s/%s', $path, $this->year, BlorgPageFactory::$month_names[$month]);
         $anchor_tag->setContent($date->getMonthName());
         $anchor_tag->display();
         $heading_tag->close();
         $post_ul_tag = new SwatHtmlTag('ul');
         $post_ul_tag->class = 'entries';
         $post_ul_tag->open();
         foreach ($posts as $post) {
             $post_li_tag = new SwatHtmlTag('li');
             $post_li_tag->open();
             $view->display($post);
             $post_li_tag->close();
         }
         $post_ul_tag->close();
         $li_tag->close();
     }
     $ul_tag->close();
 }
 /**
  * @param SiteApplication $app   the application in which to get the view.
  * @param BuildingBlock   $block the block for which to get the view. The
  *                               block determines the view type that is
  *                               returned.
  *
  * @return BuildingBlockView a block view instance for displaying blocks
  *                           of the specified type.
  *
  * @see SwatViewFactory::get()
  * @see BuildingBlockViewFactory::getViewType()
  */
 public static function getBlockView(SiteApplication $app, BuildingBlock $block)
 {
     return SiteViewFactory::get($app, self::getViewType($block));
 }
 /**
  * Displays search results for a collection of posts
  *
  * @param BlorgPostWrapper $posts the posts to display
  *                                          search results for.
  */
 protected function displayPosts(BlorgPostWrapper $posts)
 {
     $view = SiteViewFactory::get($this->app, 'post');
     $view->setPartMode('bodytext', SiteView::MODE_SUMMARY);
     $view->setPartMode('extended_bodytext', SiteView::MODE_NONE);
     foreach ($posts as $post) {
         $view->display($post);
     }
 }
 protected function buildComments()
 {
     $global_status = $this->app->config->pinhole->global_comment_status;
     if ($global_status === null) {
         $status = $this->photo->comment_status;
     } elseif ($global_status == true) {
         // comments are globally turned on
         $status = $this->app->config->pinhole->default_comment_status;
     } else {
         // comments are globally turned off
         $status = SiteCommentStatus::CLOSED;
     }
     if ($status !== SiteCommentStatus::CLOSED) {
         $comments = $this->photo->getVisibleComments();
         if (count($comments) > 0) {
             $this->ui->getWidget('comments_frame')->visible = true;
             ob_start();
             $div_tag = new SwatHtmlTag('div');
             $div_tag->id = 'comments';
             $div_tag->class = 'photo-comments';
             $div_tag->open();
             $view = SiteViewFactory::get($this->app, 'photo-comment');
             foreach ($comments as $comment) {
                 $view->display($comment);
             }
             $div_tag->close();
             $this->ui->getWidget('comments')->content = ob_get_clean();
         }
         ob_start();
         $this->comment_ui->display();
         $this->ui->getWidget('comments_ui')->content = ob_get_clean();
     }
 }
Example #16
0
     * checked against the site's domain to ensure the page has been arrived at
     * via another site.
     *
     * @param SiteApplication $app The current application
     * @param string $ad_type The type of ad to display
     */
    public static function displayAd(SiteApplication $app, $type)
    {
        $type_name = 'ad_' . $type;
        if ($app->config->pinhole->{$type_name} != '') {
            $base_href = $app->getBaseHref();
            $referer = SiteApplication::initVar('HTTP_REFERER', null, SiteApplication::VAR_SERVER);
            // Display ad if referers only is off OR if there is a referer and
            // it does not start with the app base href.
            if (!$app->config->pinhole->ad_referers_only || $referer !== null && strncmp($referer, $base_href, strlen($base_href)) != 0) {
                echo '<div class="ad">';
                echo $app->config->pinhole->{$type_name};
                echo '</div>';
            }
        }
    }
}
Pinhole::setupGettext();
// require here to prevent "Class __PHP_Incomplete_Class has no unserializer" errors
require_once 'Pinhole/dataobjects/PinholeAdminUser.php';
SwatDBClassMap::addPath(dirname(__FILE__) . '/dataobjects');
SwatDBClassMap::add('AdminUser', 'PinholeAdminUser');
SiteGadgetFactory::addPath('Pinhole/gadgets');
SiteViewFactory::addPath('Pinhole/views');
SiteViewFactory::registerView('photo-comment', 'PinholeCommentView');