Browse Source

- New blog feature : you can have a unique URL for a public Movim article

- Add the version in about #1450928
pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
25397cf07f
  1. 26
      app/models/postn/PostnDAO.php
  2. 8
      app/widgets/About/About.php
  3. 2
      app/widgets/About/about.tpl
  4. 8
      app/widgets/Blog/Blog.php
  5. 24
      app/widgets/Blog/blog.tpl
  6. 10
      system/Route.php

26
app/models/postn/PostnDAO.php

@ -383,6 +383,32 @@ class PostnDAO extends SQL {
return $this->run('ContactPostn');
}
function getPublicItem($origin, $node, $nodeid, $limitf = false, $limitr = false) {
$this->_sql = '
select *, postn.aid, privacy.value as privacy from postn
left outer join contact on postn.aid = contact.jid
left outer join privacy on postn.nodeid = privacy.pkey
where postn.origin = :origin
and postn.node = :node
and privacy.value = 1
and postn.nodeid = :nodeid
order by postn.published desc';
if($limitr)
$this->_sql = $this->_sql.' limit '.$limitr.' offset '.$limitf;
$this->prepare(
'Postn',
array(
'origin' => $origin,
'node' => $node,
'nodeid' => $nodeid,
)
);
return $this->run('ContactPostn');
}
// TODO: fixme
function getComments($posts) {
$commentsid = '';

8
app/widgets/About/About.php

@ -15,6 +15,12 @@
class About extends WidgetBase
{
function load() {
function load()
{
}
function display()
{
$this->view->assign('version', APP_VERSION);
}
}

2
app/widgets/About/about.tpl

@ -1,5 +1,5 @@
<div class="tabelem" title="{$c->__('page.about')}" id="about">
<h2 class="padded_top_bottom">{$c->__('page.about')} </h2>
<h2 class="padded_top_bottom">Movim {$version} - {$c->__('page.about')} </h2>
<ul class="thick divided">
<li class="condensed">

8
app/widgets/Blog/Blog.php

@ -24,8 +24,12 @@ class Blog extends WidgetCommon {
$this->view->assign('contact', $c);
$pd = new \modl\PostnDAO();
$messages = $pd->getPublic($from, $node, 10, 0);
if($id = $this->get('i')) {
$messages = $pd->getPublicItem($from, $node, $id, 10, 0);
} else {
$messages = $pd->getPublic($from, $node, 10, 0);
}
$this->view->assign('posts', $messages);
}
}

24
app/widgets/Blog/blog.tpl

@ -15,9 +15,17 @@
</span>
<span>
{if="$contact"}
<h2>{$c->__('blog.title', $contact->getTrueName())}</h2>
<h2>
<a href="{$c->route('blog', array($contact->jid))}">
{$c->__('blog.title', $contact->getTrueName())}
</a>
</h2>
{else}
<h2>{$c->__('page.blog')}</h2>
<h2>
<a href="{$c->route('blog', array($contact->jid))}">
{$c->__('page.blog')}
</a>
</h2>
{/if}
</span>
</li>
@ -39,11 +47,13 @@
</span>
{/if}
<h2>
{if="$value->title != null"}
{$value->title}
{else}
{$c->__('post.default_title')}
{/if}
<a href="{$c->route('blog', array($value->origin, $value->nodeid))}">
{if="$value->title != null"}
{$value->title}
{else}
{$c->__('post.default_title')}
{/if}
</a>
</h2>
<p>
{if="$value->node == 'urn:xmpp:microblog:0' && $value->getContact()->getTrueName() != ''"}

10
system/Route.php

@ -9,7 +9,7 @@ class Route extends \BaseController {
'account' => false,
'accountnext' => array('s', 'err'),
'admin' => false,
'blog' => array('f'),
'blog' => array('f', 'i'),
'chat' => array('f'),
'conf' => false,
'contact' => array('f'),
@ -74,9 +74,9 @@ class Route extends \BaseController {
return BASE_URI;
if(isset($routes[$page])) {
if($params != false && count($routes[$page]) != count($params)) {
throw new Exception(__('error.route', $page));
} else {
//if($params != false && count($routes[$page]) != count($params)) {
//throw new Exception(__('error.route', $page));
//} else {
if($tab != false)
$tab = '#'.$tab;
//We construct a classic URL if the rewriting is disabled
@ -103,7 +103,7 @@ class Route extends \BaseController {
$uri .= '/'.$params;
}
return $uri.$tab;
}
//}
} else {
throw new Exception(__('Route not set for the page %s', $page));
}

Loading…
Cancel
Save