2014-07-28 19:55:18 +03:00
|
|
|
|
{**
|
|
|
|
|
* Базовая форма создания топика
|
|
|
|
|
*
|
|
|
|
|
* @param object $topic
|
|
|
|
|
* @param object $type
|
|
|
|
|
* @param array $blogs
|
2014-11-19 14:07:42 +02:00
|
|
|
|
* @param array $blogId
|
2014-07-28 19:55:18 +03:00
|
|
|
|
*}
|
|
|
|
|
|
|
|
|
|
{$topic = $smarty.local.topic}
|
|
|
|
|
{$type = $smarty.local.type}
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{block 'add_topic_options'}{/block}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
{hook run="add_topic_begin"}
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{block 'add_topic_header_after'}{/block}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-11-03 18:48:05 +02:00
|
|
|
|
<form action="" method="POST" enctype="multipart/form-data" id="topic-add-form" class="js-form-validate" data-content-action="{( $topic ) ? 'edit' : 'add'}">
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{hook run="form_add_topic_begin"}
|
|
|
|
|
{block 'add_topic_form_begin'}{/block}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Выбор блога *}
|
|
|
|
|
{$items = [[
|
|
|
|
|
'value' => 0,
|
|
|
|
|
'text' => $aLang.topic.add.fields.blog.option_personal
|
|
|
|
|
]]}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{foreach $smarty.local.blogs as $blog}
|
|
|
|
|
{$items[] = [
|
|
|
|
|
'value' => $blog->getId(),
|
|
|
|
|
'text' => $blog->getTitle()
|
|
|
|
|
]}
|
|
|
|
|
{/foreach}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{include 'components/field/field.select.tpl'
|
|
|
|
|
name = 'topic[blog_id]'
|
|
|
|
|
label = $aLang.topic.add.fields.blog.label
|
|
|
|
|
note = $aLang.topic.add.fields.blog.note
|
|
|
|
|
inputClasses = 'js-topic-add-title'
|
|
|
|
|
items = $items
|
2014-11-19 14:07:42 +02:00
|
|
|
|
selectedValue = {( $topic ) ? $topic->getBlogId() : $smarty.local.blogId}}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Заголовок топика *}
|
|
|
|
|
{include 'components/field/field.text.tpl'
|
|
|
|
|
name = 'topic[topic_title]'
|
|
|
|
|
value = {(( $topic ) ? $topic->getTitle() : '')|escape}
|
|
|
|
|
entityField = 'topic_title'
|
|
|
|
|
entity = 'ModuleTopic_EntityTopic'
|
|
|
|
|
label = $aLang.topic.add.fields.title.label}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{block 'add_topic_form_text_before'}{/block}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Текст топика *}
|
|
|
|
|
{if $type->getParam('allow_text')}
|
|
|
|
|
{include 'components/editor/editor.tpl'
|
|
|
|
|
name = 'topic[topic_text_source]'
|
|
|
|
|
value = (( $topic ) ? $topic->getTextSource() : '')|escape
|
|
|
|
|
label = $aLang.topic.add.fields.text.label
|
|
|
|
|
entityField = 'topic_text_source'
|
|
|
|
|
entity = 'ModuleTopic_EntityTopic'
|
2014-10-21 16:59:33 +03:00
|
|
|
|
inputClasses = 'js-editor-default'
|
2014-10-18 09:07:45 +03:00
|
|
|
|
mediaTargetType = 'topic'
|
|
|
|
|
mediaTargetId = ( $topic ) ? $topic->getId() : ''}
|
|
|
|
|
{/if}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{block 'add_topic_form_text_after'}{/block}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Теги *}
|
|
|
|
|
{if $type->getParam('allow_tags')}
|
|
|
|
|
{include 'components/field/field.text.tpl'
|
|
|
|
|
name = 'topic[topic_tags]'
|
|
|
|
|
value = {(( $topic ) ? $topic->getTags() : '')|escape}
|
|
|
|
|
rules = [ 'required' => true, 'rangetags' => '[1,15]' ]
|
2014-10-21 16:59:33 +03:00
|
|
|
|
label = {lang 'topic.add.fields.tags.label'}
|
|
|
|
|
note = {lang 'topic.add.fields.tags.note'}
|
2014-10-23 16:55:39 +03:00
|
|
|
|
inputClasses = 'width-full autocomplete-tags-sep'}
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{/if}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Показывает дополнительные поля *}
|
2014-10-21 16:59:33 +03:00
|
|
|
|
{insert name='block' block='propertyUpdate' params=[
|
|
|
|
|
'target' => $topic,
|
|
|
|
|
'entity' => 'ModuleTopic_EntityTopic',
|
|
|
|
|
'target_type' => "topic_{$type->getCode()}"
|
|
|
|
|
]}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-12-24 11:58:10 +02:00
|
|
|
|
{* Выбор превью *}
|
|
|
|
|
{include 'components/field/field.image-ajax.tpl'
|
|
|
|
|
label = 'Превью'
|
|
|
|
|
modalTitle = 'Выбор превью для топика'
|
|
|
|
|
targetType = 'topic'
|
|
|
|
|
targetId = ( $topic ) ? $topic->getId() : ''
|
|
|
|
|
classes = 'js-topic-add-field-image-preview'}
|
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Вставка опросов *}
|
|
|
|
|
{if $type->getParam('allow_poll')}
|
|
|
|
|
{include 'components/poll/poll.manage.tpl'
|
|
|
|
|
targetType = 'topic'
|
|
|
|
|
targetId = ( $topic ) ? $topic->getId() : ''}
|
|
|
|
|
{/if}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Запретить комментарии *}
|
|
|
|
|
{include 'components/field/field.checkbox.tpl'
|
|
|
|
|
name = 'topic[topic_forbid_comment]'
|
|
|
|
|
checked = {( $topic && $topic->getForbidComment() ) ? true : false }
|
|
|
|
|
note = $aLang.topic.add.fields.forbid_comments.note
|
|
|
|
|
label = $aLang.topic.add.fields.forbid_comments.label}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Принудительный вывод топиков на главную (доступно только админам) *}
|
|
|
|
|
{if $oUserCurrent->isAdministrator()}
|
|
|
|
|
{include 'components/field/field.checkbox.tpl'
|
|
|
|
|
name = 'topic[topic_publish_index]'
|
|
|
|
|
checked = {($topic && $topic->getPublishIndex()) ? true : false }
|
|
|
|
|
note = $aLang.topic.add.fields.publish_index.note
|
|
|
|
|
label = $aLang.topic.add.fields.publish_index.label}
|
2014-12-28 16:59:55 +02:00
|
|
|
|
|
|
|
|
|
{include 'components/field/field.checkbox.tpl'
|
|
|
|
|
name = 'topic[topic_skip_index]'
|
|
|
|
|
checked = {($topic && $topic->getSkipIndex()) ? true : false }
|
|
|
|
|
note = $aLang.topic.add.fields.skip_index.note
|
|
|
|
|
label = $aLang.topic.add.fields.skip_index.label}
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{/if}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{block 'add_topic_form_end'}{/block}
|
|
|
|
|
{hook run="form_add_topic_end"}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Скрытые поля *}
|
|
|
|
|
{include 'components/field/field.hidden.tpl' name='topic_type' value=$type->getCode()}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{if $topic}
|
|
|
|
|
{include "components/field/field.hidden.tpl" name='topic[id]' value=$topic->getId()}
|
|
|
|
|
{/if}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{**
|
|
|
|
|
* Кнопки
|
|
|
|
|
*}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Опубликовать / Сохранить изменения *}
|
|
|
|
|
{include 'components/button/button.tpl'
|
|
|
|
|
id = {( $topic ) ? 'submit-edit-topic-publish' : 'submit-add-topic-publish' }
|
|
|
|
|
mods = 'primary'
|
|
|
|
|
classes = 'fl-r'
|
2014-11-05 17:45:27 +02:00
|
|
|
|
text = $aLang.topic.add.button[ ( $sEvent == 'add' or ( $topic && $topic->getPublish() == 0 ) ) ? 'publish' : 'update' ]}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Превью *}
|
|
|
|
|
{include 'components/button/button.tpl' type='button' classes='js-topic-preview-text-button' text=$aLang.common.preview_text}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{* Сохранить в черновиках / Перенести в черновики *}
|
2014-11-03 18:48:05 +02:00
|
|
|
|
{if ! $topic || ( $topic && $topic->getPublish() != 0 )}
|
|
|
|
|
{include 'components/button/button.tpl' type='button' classes='js-topic-draft-button' text=$aLang.topic.add.button[ ( $sEvent == 'add' ) ? 'save_as_draft' : 'mark_as_draft' ]}
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{/if}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{* Блок с превью текста *}
|
2014-11-20 11:20:17 +02:00
|
|
|
|
{include './topic-preview.tpl'}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
|
2014-10-18 09:07:45 +03:00
|
|
|
|
{block 'add_topic_end'}{/block}
|
2014-07-28 19:55:18 +03:00
|
|
|
|
{hook run="add_topic_end"}
|