mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-16 23:00:51 +03:00
Кнопка "Написать в блог"
This commit is contained in:
parent
18bf206a55
commit
2f2fc5c8c8
|
@ -204,6 +204,8 @@ class ActionContent extends Action
|
|||
protected function EventAdd()
|
||||
{
|
||||
$sTopicType = $this->GetParam(0);
|
||||
$iBlogId = (int) getRequest('blog_id');
|
||||
|
||||
if (!$oTopicType = $this->Topic_GetTopicType($sTopicType)) {
|
||||
return parent::EventNotFound();
|
||||
}
|
||||
|
@ -224,6 +226,7 @@ class ActionContent extends Action
|
|||
*/
|
||||
$this->Viewer_Assign('oTopicType', $oTopicType);
|
||||
$this->Viewer_Assign('aBlogsAllow', $this->Blog_GetBlogsAllowByUser($this->oUserCurrent));
|
||||
$this->Viewer_Assign('blogId', $iBlogId);
|
||||
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic.add.title.add'));
|
||||
$this->SetTemplateAction('add');
|
||||
}
|
||||
|
|
|
@ -147,6 +147,15 @@ return array(
|
|||
'date_created' => 'Дата создания',
|
||||
'rating_limit' => 'Ограничение на постинг',
|
||||
'rss' => 'RSS',
|
||||
// Действия
|
||||
'actions' => array(
|
||||
'write' => 'Написать в блог',
|
||||
'join' => '___blog.join.join___',
|
||||
'leave' => '___blog.join.leave___',
|
||||
'rss' => 'Подписаться через RSS',
|
||||
'edit' => '___common.edit___',
|
||||
'remove' => '___common.remove___',
|
||||
),
|
||||
// Сообщения
|
||||
'alerts' => array(
|
||||
'private' => 'Это закрытый блог, у вас нет прав на просмотр контента',
|
||||
|
@ -1128,7 +1137,7 @@ return array(
|
|||
'rating' => '___vote.rating___',
|
||||
'date_last_session' => 'Последний визит',
|
||||
'date_registration' => 'Дата регистрации',
|
||||
// Пол
|
||||
// Действия
|
||||
'actions' => array(
|
||||
'send_message' => '___talk.send_message___',
|
||||
'follow' => 'Подписаться',
|
||||
|
|
|
@ -21,5 +21,5 @@
|
|||
{/block}
|
||||
|
||||
{block 'layout_content'}
|
||||
{include 'components/topic/topic-add.tpl' topic=$oTopicEdit type=$oTopicType blogs=$aBlogsAllow}
|
||||
{include 'components/topic/topic-add.tpl' topic=$oTopicEdit type=$oTopicType blogs=$aBlogsAllow blogId=$blogId}
|
||||
{/block}
|
|
@ -15,56 +15,69 @@
|
|||
{$blog = $oBlog}
|
||||
|
||||
<ul class="profile-actions" id="profile_actions">
|
||||
{* Является ли пользователь администратором или управляющим блога *}
|
||||
{$isBlogAdmin = $oUserCurrent && ( $oUserCurrent->getId() == $blog->getOwnerId() || $oUserCurrent->isAdministrator() || $blog->getUserIsAdministrator() )}
|
||||
|
||||
{* Список экшенов *}
|
||||
{$actions = []}
|
||||
|
||||
{* Вступить/покинуть *}
|
||||
{if $oUserCurrent && $oUserCurrent->getId() != $blog->getOwnerId() && $blog->getType() == 'open'}
|
||||
<li>
|
||||
<span class="js-blog-join" data-blog-id="{$blog->getId()}">
|
||||
{($blog->getUserIsJoin()) ? $aLang.blog.join.leave : $aLang.blog.join.join}
|
||||
</span>
|
||||
</li>
|
||||
{$actions[] = [
|
||||
'classes' => 'js-blog-join',
|
||||
'attributes' => "data-blog-id=\"{$blog->getId()}\"",
|
||||
'text' => {($blog->getUserIsJoin()) ? {lang 'blog.actions.leave'} : {lang 'blog.actions.join'}}
|
||||
]}
|
||||
{/if}
|
||||
|
||||
{* Отправить сообщение *}
|
||||
<li>
|
||||
<a href="{router page='rss'}blog/{$blog->getUrl()}/">
|
||||
Подписаться через RSS
|
||||
</a>
|
||||
</li>
|
||||
{* Написать в блог *}
|
||||
{if $oUserCurrent && ( ( $blog->getUserIsJoin() && $oUserCurrent->getRating() >= $blog->getLimitRatingTopic() ) || $isBlogAdmin )}
|
||||
{$actions[] = [
|
||||
'url' => "{$LS->Topic_GetTopicType('topic')->getUrlForAdd()}?blog_id={$blog->getId()}",
|
||||
'text' => {lang 'blog.actions.write'}
|
||||
]}
|
||||
{/if}
|
||||
|
||||
{* Является ли пользователь администратором или управляющим блога *}
|
||||
{$isBlogAdmin = $oUserCurrent && ($oUserCurrent->getId() == $blog->getOwnerId() || $oUserCurrent->isAdministrator() || $blog->getUserIsAdministrator())}
|
||||
{* Подписаться через RSS *}
|
||||
{$actions[] = [
|
||||
'url' => "{router page='rss'}blog/{$blog->getUrl()}/",
|
||||
'text' => {lang 'blog.actions.rss'}
|
||||
]}
|
||||
|
||||
{if $oUserCurrent && $isBlogAdmin}
|
||||
{$actionbarItems = [ [ 'icon' => 'icon-edit', 'url' => "{router page='blog'}edit/{$blog->getId()}/", 'text' => $aLang.common.edit ] ]}
|
||||
{* Редактировать *}
|
||||
{$actions[] = [ 'icon' => 'icon-edit', 'url' => "{router page='blog'}edit/{$blog->getId()}/", 'text' => $aLang.common.edit ]}
|
||||
|
||||
{* Удалить *}
|
||||
{if $oUserCurrent->isAdministrator()}
|
||||
{$actionbarItems[] = [
|
||||
{$actions[] = [
|
||||
'icon' => 'icon-trash',
|
||||
'attributes' => 'data-type="modal-toggle" data-modal-target="modal-blog-delete"',
|
||||
'text' => $aLang.common.remove
|
||||
]}
|
||||
{else}
|
||||
{$actionbarItems[] = [
|
||||
{$actions[] = [
|
||||
'icon' => 'icon-trash',
|
||||
'url' => "{router page='blog'}delete/{$blog->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}",
|
||||
'classes' => 'js-blog-remove',
|
||||
'text' => $aLang.common.remove
|
||||
]}
|
||||
{/if}
|
||||
|
||||
{foreach $actionbarItems as $item}
|
||||
<li>
|
||||
{if $item[ 'url' ]}
|
||||
<a href="{$item[ 'url' ]}" class="{$item[ 'classes' ]}" {$item[ 'attributes' ]}>
|
||||
{$item[ 'text' ]}
|
||||
</a>
|
||||
{else}
|
||||
<span class="{$item[ 'classes' ]}" {$item[ 'attributes' ]}>
|
||||
{$item[ 'text' ]}
|
||||
</span>
|
||||
{/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
{* Вывод экшенов *}
|
||||
{foreach $actions as $item}
|
||||
<li>
|
||||
{if $item[ 'url' ]}
|
||||
<a href="{$item[ 'url' ]}" class="{$item[ 'classes' ]}" {$item[ 'attributes' ]}>
|
||||
{$item[ 'text' ]}
|
||||
</a>
|
||||
{else}
|
||||
<span class="{$item[ 'classes' ]}" {$item[ 'attributes' ]}>
|
||||
{$item[ 'text' ]}
|
||||
</span>
|
||||
{/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/block}
|
|
@ -4,6 +4,7 @@
|
|||
* @param object $topic
|
||||
* @param object $type
|
||||
* @param array $blogs
|
||||
* @param array $blogId
|
||||
*}
|
||||
|
||||
{$topic = $smarty.local.topic}
|
||||
|
@ -39,7 +40,7 @@
|
|||
note = $aLang.topic.add.fields.blog.note
|
||||
inputClasses = 'js-topic-add-title'
|
||||
items = $items
|
||||
selectedValue = {( $topic ) ? $topic->getBlogId() : '' }}
|
||||
selectedValue = {( $topic ) ? $topic->getBlogId() : $smarty.local.blogId}}
|
||||
|
||||
|
||||
{* Заголовок топика *}
|
||||
|
|
Loading…
Reference in a new issue