Browse Source

#168 post is editable if link exists + rel=related adds link in attachment

pull/324/head
Christine Ho 10 years ago
parent
commit
522f8918e4
  1. 11
      app/models/postn/Postn.php
  2. 1
      app/widgets/Post/Post.php
  3. 4
      app/widgets/Post/_post.tpl
  4. 0
      app/widgets/Post/post.js

11
app/models/postn/Postn.php

@ -311,7 +311,6 @@ class Postn extends Model {
);
$links = unserialize($this->links);
foreach($links as $l) {
if(isset($l['type']) && $this->typeIsPicture($l['type'])) {
if($this->picture == null) {
@ -331,9 +330,11 @@ class Postn extends Model {
array_push($attachements['links'], array('href' => $l['href'], 'url' => parse_url($l['href'])));
}
}
} elseif(isset($l['rel'])
&& $l['rel'] == 'enclosure') {
array_push($attachements['files'], $l);
} elseif(isset($l['rel'])){
if ($l['rel'] == 'enclosure')
array_push($attachements['files'], $l);
elseif ($l['rel'] == 'related')
array_push($attachements['links'], array('href' => $l['href'], 'url' => parse_url($l['href'])));
}
}
}
@ -399,7 +400,7 @@ class Postn extends Model {
public function isEditable()
{
return ($this->contentraw != null);
return ($this->contentraw != null || $this->links != null);
}
public function isShort()

1
app/widgets/Post/Post.php

@ -32,7 +32,6 @@ class Post extends \Movim\Widget\Base
{
function load()
{
$this->addjs('post.js');
$this->registerEvent('microblog_commentsget_handle', 'onComments');
$this->registerEvent('microblog_commentpublish_handle', 'onCommentPublished');
$this->registerEvent('microblog_commentsget_error', 'onCommentsError');

4
app/widgets/Post/_post.tpl

@ -21,7 +21,9 @@
{if="$post->isMine() && !$public"}
{if="$post->isEditable()"}
<span class="control icon active" onclick="Publish_ajaxCreate('{$post->origin}', '{$post->node}', '{$post->nodeid}')" title="{$c->__('button.edit')}">
<span class="control icon active"
onclick="Publish_ajaxCreate('{$post->origin}', '{$post->node}', '{$post->nodeid}')"
title="{$c->__('button.edit')}">
<i class="zmdi zmdi-edit"></i>
</span>
{/if}

0
app/widgets/Post/post.js

Loading…
Cancel
Save