1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-01 07:38:11 +03:00

Компонент topic

This commit is contained in:
Denis Shakhov 2014-07-28 23:55:18 +07:00
parent 90a875dbd6
commit 63b816f524
40 changed files with 563 additions and 581 deletions

View file

@ -1399,7 +1399,7 @@ class ActionAjax extends Action {
* Пропускаем топик из черновиков
*/
if (!$oTopic->getPublish()) {
$this->Message_AddErrorSingle($this->Lang_Get('error_favorite_topic_is_draft'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.add.notices.error_favourite_draft'),$this->Lang_Get('error'));
return;
}
/**
@ -1417,7 +1417,7 @@ class ActionAjax extends Action {
);
$oTopic->setCountFavourite($oTopic->getCountFavourite()+1);
if ($this->Topic_AddFavouriteTopic($oFavouriteTopicNew) and $this->Topic_UpdateTopic($oTopic)) {
$this->Message_AddNoticeSingle($this->Lang_Get('topic_favourite_add_ok'),$this->Lang_Get('attention'));
$this->Message_AddNoticeSingle($this->Lang_Get('favourite.notices.add_success'),$this->Lang_Get('attention'));
$this->Viewer_AssignAjax('bState',true);
$this->Viewer_AssignAjax('iCount', $oTopic->getCountFavourite());
} else {
@ -1425,17 +1425,17 @@ class ActionAjax extends Action {
}
}
if (!$oFavouriteTopic and !$iType) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_favourite_add_no'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('favourite.notices.already_removed'),$this->Lang_Get('error'));
return;
}
if ($oFavouriteTopic and $iType) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_favourite_add_already'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('favourite.notices.already_added'),$this->Lang_Get('error'));
return;
}
if ($oFavouriteTopic and !$iType) {
$oTopic->setCountFavourite($oTopic->getCountFavourite()-1);
if ($this->Topic_DeleteFavouriteTopic($oFavouriteTopic) and $this->Topic_UpdateTopic($oTopic)) {
$this->Message_AddNoticeSingle($this->Lang_Get('topic_favourite_del_ok'),$this->Lang_Get('attention'));
$this->Message_AddNoticeSingle($this->Lang_Get('favourite.notices.remove_success'),$this->Lang_Get('attention'));
$this->Viewer_AssignAjax('bState',false);
$this->Viewer_AssignAjax('iCount', $oTopic->getCountFavourite());
} else {
@ -1882,7 +1882,7 @@ class ActionAjax extends Action {
* Проверяем текст комментария
*/
if (!$this->Validate_Validate('string',$sText,array('min'=>2,'max'=>10000,'allowEmpty'=>false))) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_comment_add_text_error'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.comments.notices.error_text'),$this->Lang_Get('error'));
return;
}

View file

@ -1026,28 +1026,28 @@ class ActionBlog extends Action {
* Проверяем разрешено ли постить комменты
*/
if (!$this->ACL_CanPostComment($this->oUserCurrent,$oTopic) and !$this->oUserCurrent->isAdministrator()) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_comment_acl'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.comments.notices.acl'),$this->Lang_Get('error'));
return;
}
/**
* Проверяем разрешено ли постить комменты по времени
*/
if (!$this->ACL_CanPostCommentTime($this->oUserCurrent) and !$this->oUserCurrent->isAdministrator()) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_comment_limit'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.comments.notices.limit'),$this->Lang_Get('error'));
$bOk = false;
}
/**
* Проверяем запрет на добавления коммента автором топика
*/
if ($oTopic->getForbidComment()) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_comment_notallow'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.comments.notices.not_allowed'),$this->Lang_Get('error'));
$bOk = false;
}
/**
* Проверяем текст комментария
*/
if (!func_check($sText,'text',2,10000)) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_comment_add_text_error'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.comments.notices.error_text'),$this->Lang_Get('error'));
$bOk = false;
}
@ -1104,7 +1104,7 @@ class ActionBlog extends Action {
* Проверка на дублирующий коммент
*/
if ($this->Comment_GetCommentUnique($oTopic->getId(),'topic',$this->oUserCurrent->getId(),$sParentId,md5($sText))) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_comment_spam'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.comments.notices.spam'),$this->Lang_Get('error'));
$bOk = false;
}

View file

@ -66,7 +66,7 @@ class ActionContent extends Action {
/**
* Устанавливаем title страницы
*/
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic_title'));
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic.topics'));
}
/**
* Регистрируем евенты
@ -118,7 +118,7 @@ class ActionContent extends Action {
*/
$this->Viewer_Assign('aPaging',$aPaging);
$this->Viewer_Assign('aTopics',$aTopics);
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic_menu_'.$this->sCurrentEvent));
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic.nav.'.$this->sCurrentEvent));
}
protected function EventDelete() {
@ -177,7 +177,7 @@ class ActionContent extends Action {
*/
$this->Viewer_Assign('aBlogsAllow',$this->Blog_GetBlogsAllowByUser($this->oUserCurrent));
$this->Viewer_Assign('oTopicType',$oTopicType);
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic_topic_edit'));
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic.add.title.edit'));
$this->Viewer_Assign('oTopicEdit', $oTopic);
$this->SetTemplateAction('add');
@ -202,7 +202,7 @@ class ActionContent extends Action {
*/
$this->Viewer_Assign('oTopicType',$oTopicType);
$this->Viewer_Assign('aBlogsAllow',$this->Blog_GetBlogsAllowByUser($this->oUserCurrent));
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic_topic_create'));
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic.add.title.add'));
$this->SetTemplateAction('add');
}
@ -220,7 +220,7 @@ class ActionContent extends Action {
* Проверяем разрешено ли постить топик по времени
*/
if (isPost('submit_topic_publish') and !$oTopic->getPublishDraft() and !$this->ACL_CanPostTopicTime($this->oUserCurrent)) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_time_limit'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.add.notices.time_limit'),$this->Lang_Get('error'));
return;
}
@ -283,7 +283,7 @@ class ActionContent extends Action {
* Проверяем права на постинг в блог
*/
if (!$this->ACL_IsAllowBlog($oBlog,$this->oUserCurrent)) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_create_blog_error_noallow'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.add.notices.error_blog_not_allowed'),$this->Lang_Get('error'));
return false;
}
/**
@ -359,7 +359,7 @@ class ActionContent extends Action {
* Проверяем разрешено ли постить топик по времени
*/
if (isPost('submit_topic_publish') and !$this->ACL_CanPostTopicTime($this->oUserCurrent)) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_time_limit'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.add.notices.time_limit'),$this->Lang_Get('error'));
return;
}
/**
@ -409,7 +409,7 @@ class ActionContent extends Action {
* Проверяем права на постинг в блог
*/
if (!$this->ACL_IsAllowBlog($oBlog,$this->oUserCurrent)) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_create_blog_error_noallow'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.add.notices.error_blog_not_allowed'),$this->Lang_Get('error'));
return false;
}
/**
@ -493,7 +493,7 @@ class ActionContent extends Action {
* Допустимый тип топика?
*/
if (!$this->Topic_IsAllowTopicType($sType=getRequestStr('topic_type'))) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_create_type_error'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.add.notices.error_type'),$this->Lang_Get('error'));
return;
}
/**

View file

@ -364,11 +364,11 @@ class ActionRss extends Action {
protected function getTopicText($oTopic) {
$sText=$oTopic->getTextShort();
if ($oTopic->getTextShort()!=$oTopic->getText()) {
$sText.="<br><a href=\"{$oTopic->getUrl()}#cut\" title=\"{$this->Lang_Get('topic_read_more')}\">";
$sText.="<br><a href=\"{$oTopic->getUrl()}#cut\" title=\"{$this->Lang_Get('topic.read_more')}\">";
if ($oTopic->getCutText()) {
$sText.=htmlspecialchars($oTopic->getCutText());
} else {
$sText.=$this->Lang_Get('topic_read_more');
$sText.=$this->Lang_Get('topic.read_more');
}
$sText.="</a>";
}

View file

@ -668,7 +668,7 @@ class ActionTalk extends Action {
* Проверка на дублирующий коммент
*/
if ($this->Comment_GetCommentUnique($oTalk->getId(),'talk',$this->oUserCurrent->getId(),$sParentId,md5($sText))) {
$this->Message_AddErrorSingle($this->Lang_Get('topic_comment_spam'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('topic.comments.notices.spam'),$this->Lang_Get('error'));
return;
}
/**

View file

@ -102,8 +102,8 @@ class ActionUserfeed extends Action {
* Загружаем данные в ajax ответ
*/
$oViewer=$this->Viewer_GetLocalViewer();
$oViewer->Assign('aTopics', $aTopics);
$this->Viewer_AssignAjax('html', $oViewer->Fetch('topics/topic_list.tpl'));
$oViewer->Assign('topics', $aTopics, true);
$this->Viewer_AssignAjax('html', $oViewer->Fetch('components/topic/topic-list.tpl'));
$this->Viewer_AssignAjax('count_loaded', count($aTopics));
if (count($aTopics)) {

View file

@ -44,9 +44,9 @@ class ModuleTopic_EntityTopic extends Entity {
*/
public function Init() {
parent::Init();
$this->aValidateRules[]=array('topic_title','string','max'=>Config::Get('module.topic.title_max_length'),'min'=>Config::Get('module.topic.title_min_length'),'allowEmpty'=>Config::Get('module.topic.title_allow_empty'),'label'=>$this->Lang_Get('topic_create_title'));
$this->aValidateRules[]=array('topic_text_source','string','max'=>Config::Get('module.topic.max_length'),'min'=>Config::Get('module.topic.min_length'),'allowEmpty'=>Config::Get('module.topic.allow_empty'),'condition'=>'isNeedValidateText','label'=>$this->Lang_Get('topic_create_text'));
$this->aValidateRules[]=array('topic_tags','tags','count'=>15,'condition'=>'isNeedValidateTags','label'=>$this->Lang_Get('topic_create_tags'),'allowEmpty'=>Config::Get('module.topic.allow_empty_tags'));
$this->aValidateRules[]=array('topic_title','string','max'=>Config::Get('module.topic.title_max_length'),'min'=>Config::Get('module.topic.title_min_length'),'allowEmpty'=>Config::Get('module.topic.title_allow_empty'),'label'=>$this->Lang_Get('topic.add.fields.title.label'));
$this->aValidateRules[]=array('topic_text_source','string','max'=>Config::Get('module.topic.max_length'),'min'=>Config::Get('module.topic.min_length'),'allowEmpty'=>Config::Get('module.topic.allow_empty'),'condition'=>'isNeedValidateText','label'=>$this->Lang_Get('topic.add.fields.text.label'));
$this->aValidateRules[]=array('topic_tags','tags','count'=>15,'condition'=>'isNeedValidateTags','label'=>$this->Lang_Get('topic.add.fields.tags.label'),'allowEmpty'=>Config::Get('module.topic.allow_empty_tags'));
$this->aValidateRules[]=array('blog_id','blog_id');
$this->aValidateRules[]=array('topic_text_source','topic_unique');
@ -86,7 +86,7 @@ class ModuleTopic_EntityTopic extends Entity {
if ($this->Topic_IsAllowTopicType($sValue)) {
return true;
}
return $this->Lang_Get('topic_create_type_error');
return $this->Lang_Get('topic.add.notices.error_type');
}
/**
* Проверка топика на уникальность
@ -102,7 +102,7 @@ class ModuleTopic_EntityTopic extends Entity {
if ($iId=$this->getId() and $oTopicEquivalent->getId()==$iId) {
return true;
}
return $this->Lang_Get('topic_create_text_error_unique');
return $this->Lang_Get('topic.add.notices.error_text_unique');
}
}
return true;
@ -125,7 +125,7 @@ class ModuleTopic_EntityTopic extends Entity {
$this->setBlogId($oBlog->getId());
return true;
}
return $this->Lang_Get('topic_create_blog_error_unknown');
return $this->Lang_Get('topic.add.notices.error_blog_not_found');
}
/**

View file

@ -87,7 +87,9 @@ return array(
// Всплывающие сообщения
'notices' => array(
'add_success' => 'Добавлено в избранное',
'remove_success' => 'Удалено из избранного'
'remove_success' => 'Удалено из избранного',
'already_added' => 'Уже добавлено в избранное!',
'already_removed' => 'Уже удалено из избранного!',
),
),
@ -586,6 +588,11 @@ return array(
'unfold_all' => 'Развернуть все',
),
// Форма добавления
'form' => array(
'title' => 'Оставить комментарий',
),
// Всплывающие сообщения
'notices' => array(
'success_restore' => 'Комментарий восстановлен',
@ -1108,110 +1115,99 @@ return array(
)
),
// TODO: Удалить, используется в ActionSubscribe
'registration_mail_error' => 'Неверный формат e-mail',
/**
* Топик
*/
'topic' => array(
'topics' => 'Топики',
'topic_plural' => 'топик;топика;топиков',
'drafts' => 'Черновики',
'read_more' => 'Читать дальше',
'author' => 'Автор топика',
'tags' => 'Теги', // Move to component tags
'share' => 'Поделиться',
'is_draft' => 'Топик находится в черновиках',
'add_favourite_tags' => 'Добавить свои теги',
// Навигация
'nav' => array(
'drafts' => 'Черновики', // TODO: Remove duplication
'published' => 'Опубликованные'
),
// Форма добавления
'add' => array(
'title' => array(
'add' => 'Создание топика',
'edit' => 'Редактирование топика',
),
// Поля
'fields' => array(
'blog' => array(
'label' => 'В какой блог публикуем?',
'note' => 'Для того чтобы написать в определенный блог, вы должны, для начала, вступить в него.',
'option_personal' => 'Мой персональный блог',
),
'title' => array(
'label' => 'Заголовок'
),
'text' => array(
'label' => 'Текст'
),
'tags' => array(
'label' => 'Текст',
'note' => 'Теги нужно разделять запятой. Например: google, вконтакте, кирпич'
),
'forbid_comments' => array(
'label' => 'Запретить комментировать',
'note' => 'Если отметить эту галку, то нельзя будет оставлять комментарии к топику'
),
'publish_index' => array(
'label' => 'Принудительно вывести на главную',
'note' => 'Если отметить эту галку, то топик сразу попадёт на главную страницу (опция доступна только администраторам)'
),
),
// Кнопки
'button' => array(
'publish' => 'Опубликовать',
'update' => 'Сохранить изменения',
'save_as_draft' => 'Сохранить в черновиках',
'mark_as_draft' => 'Перенести в черновики',
),
// Сообщения
'notices' => array(
'error_blog_not_found' => 'Выбранный вами блог не существует',
'error_blog_not_allowed' => 'Вы не можете писать в этот блог',
'error_text_unique' => 'Вы уже писали топик с таким содержанием',
'error_type' => 'Неверный тип топика', // TODO: Remove?
'error_favourite_draft' => 'Топик из черновиков нельзя добавить в избранное',
'time_limit' => 'Вам нельзя создавать топики слишком часто',
)
),
// Комментарии
'comments' => array(
// Сообщения
'notices' => array(
'error_text' => 'Текст комментария должен быть от 2 до 3000 символов и не содержать неразрешенных тегов',
'acl' => 'Ваш рейтинг слишком мал для написания комментариев',
'limit' => 'Вам нельзя писать комментарии слишком часто',
'not_allowed' => 'Автор топика запретил добавлять комментарии',
'spam' => 'Стоп! Спам!',
)
)
),
/**
* Блоги
* Избранные теги
*/
'blog_no_topic' => 'Сюда еще никто не успел написать',
/**
* Declensions
*/
'topic_declension' => 'топик;топика;топиков',
'draft_declension' => 'черновик;черновика;черновиков',
/**
* Меню блогов
*/
'blog_menu_create' => 'Блог',
/**
* Топики
*/
'topic_title' => 'Топики',
'topic_read_more' => 'Читать дальше',
'topic_author' => 'Автор топика',
'topic_date' => 'дата',
'topic_tags' => 'Теги',
'topic_tags_empty' => 'нет',
'topic_user' => 'авторский текст',
'topic_share' => 'Поделиться',
'topic_time_limit' => 'Вам нельзя создавать топики слишком часто',
'topic_comment_read' => 'читать комментарии',
'topic_comment_add' => 'Оставить комментарий',
'topic_comment_add_title' => 'написать комментарий',
'topic_comment_add_text_error' => 'Текст комментария должен быть от 2 до 3000 символов и не содержать разного рода каку',
'topic_comment_acl' => 'Ваш рейтинг слишком мал для написания комментариев',
'topic_comment_limit' => 'Вам нельзя писать комментарии слишком часто',
'topic_comment_notallow' => 'Автор топика запретил добавлять комментарии',
'topic_comment_spam' => 'Стоп! Спам!',
'topic_unpublish' => 'топик находится в черновиках',
'topic_favourite_add' => 'добавить в избранное',
'topic_favourite_add_ok' => 'Топик добавлен в избранное',
'topic_favourite_add_no' => 'Этого топика нет в вашем избранном',
'topic_favourite_add_already' => 'Этот топик уже есть в вашем избранном',
'topic_favourite_del' => 'удалить из избранного',
'topic_favourite_del_ok' => 'Топик удален из избранного',
'topic_favourite_tags_block' => 'Теги избранного',
'topic_favourite_tags_block_all' => 'Все теги',
'topic_favourite_tags_block_user' => 'Мои теги',
'error_favorite_topic_is_draft' => 'Топик из черновиков нельзя добавить в избранное',
'block_stream_comments_all' => 'Весь эфир',
'block_stream_topics_all' => 'Весь эфир',
'comments_all' => 'Прямой эфир',
'add_favourite_tags' => 'Добавить свои теги',
/**
* Меню топиков
*/
'topic_menu_add' => 'Топик',
'topic_menu_drafts' => 'Черновики',
'topic_menu_published' => 'Опубликованные',
/**
* Создание топика
*/
'topic_topic_create' => 'Создание топика',
'topic_topic_edit' => 'Редактирование топика',
'topic_create' => 'Написать',
'topic_create_blog' => 'В какой блог публикуем?',
'topic_create_blog_personal' => 'мой персональный блог',
'topic_create_blog_error_unknown' => 'Пытаетесь запостить топик в неизвестный блог?',
'topic_create_blog_error_nojoin' => 'Вы не состоите в этом блоге!',
'topic_create_blog_error_noacl' => 'Вы еще недостаточно окрепли, чтобы постить в этот блог',
'topic_create_blog_error_noallow' => 'Вы не можете писать в этот блог',
'topic_create_blog_notice' => 'Для того чтобы написать в определенный блог, вы должны, для начала, вступить в него.',
'topic_create_title' => 'Заголовок',
'topic_create_title_notice' => 'Заголовок должен быть наполнен смыслом, чтобы можно было понять, о чем будет топик.',
'topic_create_title_error' => 'Название топика должно быть от 2 до 200 символов',
'topic_create_text' => 'Текст',
'topic_create_text_notice' => 'Доступны html-теги',
'topic_create_text_error' => 'Текст топика должен быть от 2 до 15000 символов',
'topic_create_text_error_unique' => 'Вы уже писали топик с таким содержанием',
'topic_create_type_error' => 'Неверный тип топика',
'topic_create_tags' => 'Теги',
'topic_create_tags_notice' => 'Теги нужно разделять запятой. Например: google, вконтакте, кирпич',
'topic_create_tags_error_bad' => 'Проверьте правильность меток',
'topic_create_tags_error' => 'Метки топика должны быть от 2 до 50 символов с общей длиной не более 500 символов',
'topic_create_forbid_comment' => 'Запретить комментировать',
'topic_create_forbid_comment_notice' => 'Если отметить эту галку, то нельзя будет оставлять комментарии к топику',
'topic_create_publish_index' => 'Принудительно вывести на главную',
'topic_create_publish_index_notice' => 'Если отметить эту галку, то топик сразу попадёт на главную страницу (опция доступна только администраторам)',
'topic_create_submit_publish' => 'Опубликовать',
'topic_create_submit_update' => 'Сохранить изменения',
'topic_create_submit_save' => 'Сохранить в черновиках',
'topic_create_submit_preview' => 'Предпросмотр',
'topic_create_submit_preview_close' => 'Свернуть',
'topic_create_submit_notice' => 'Если нажать кнопку «Сохранить в черновиках», текст топика будет виден только Вам, а рядом с его заголовком будет отображаться замочек. Чтобы топик был виден всем, нажмите «Опубликовать».',
'topic_create_notice' => 'Не забывайте: тег <cut> сокращает длинные записи, скрывая их целиком или частично под ссылкой («читать дальше»). Скрытая часть не видна в блоге, но доступна в полной записи на странице топика.',
'topic_create_error' => 'Возникли технические неполадки при добавлении топика. Пожалуйста, повторите позже.',
'topic_edit' => 'Редактировать',
'topic_preview' => 'Предпросмотр',
'topic_delete' => 'Удалить',
'topic_delete_confirm' => 'Вы действительно хотите удалить топик?',
/**
* Люди
*/
@ -1742,5 +1738,13 @@ return array(
'12.75' => '[UTC + 12:45] Острова Чатем',
'13' => '[UTC + 13] Острова Феникс, Тонга',
'14' => '[UTC + 14] Остров Лайн'
)
),
/**
* Temp
*/
'topic_create' => 'Написать',
'registration_mail_error' => 'Неверный формат e-mail', // TODO: Удалить, используется в ActionSubscribe
'draft_declension' => 'черновик;черновика;черновиков',
'blog_menu_create' => 'Блог',
);

View file

@ -36,6 +36,6 @@
{if $bPrivateBlog}
{include 'components/alert/alert.tpl' mAlerts=$aLang.blog.alerts.private sMods='error'}
{else}
{include 'topics/topic_list.tpl'}
{include 'components/topic/topic-list.tpl' topics=$aTopics paging=$aPaging}
{/if}
{/block}

View file

@ -9,5 +9,5 @@
{/block}
{block 'layout_content'}
{include 'topics/topic_list.tpl'}
{include 'components/topic/topic-list.tpl' topics=$aTopics paging=$aPaging}
{/block}

View file

@ -6,7 +6,7 @@
{block 'layout_content'}
{* Топик *}
{include 'topics/topic.tpl'}
{include 'components/topic/topic.tpl' topic=$oTopic}
{* Комментарии *}
{include 'components/comment/comments.tpl'
@ -14,13 +14,12 @@
iTargetId = $oTopic->getId()
iAuthorId = $oTopic->getUserId()
aComments = $aComments
sAuthorNotice = $aLang.topic_author
sAuthorNotice = $aLang.topic.author
sTargetType = 'topic'
iCountComment = $oTopic->getCountComment()
sDateReadLast = $oTopic->getDateRead()
bForbidAdd = $oTopic->getForbidComment()
sNoticeNotAllow = $aLang.topic_comment_notallow
sNoticeCommentAdd = $aLang.topic_comment_add
sNoticeNotAllow = $aLang.topic.comments.notices.not_allowed
bAllowSubscribe = true
oSubscribeComment = $oTopic->getSubscribeNewComment()
aPagingCmt = $aPagingCmt

View file

@ -4,4 +4,22 @@
* @styles css/topic.css
*}
{extends file='forms/form.add.content.tpl'}
{extends 'layouts/layout.base.tpl'}
{block 'layout_options'}
{if $sEvent == 'add'}
{$sNav = 'create'}
{/if}
{/block}
{block 'layout_page_title'}
{if $sEvent == 'add'}
{$aLang.topic.add.title.add}
{else}
{$aLang.topic.add.title.edit}
{/if}
{/block}
{block 'layout_content'}
{include 'components/topic/topic-add.tpl' topic=$oTopicEdit type=$oTopicType blogs=$aBlogsAllow}
{/block}

View file

@ -2,14 +2,16 @@
* Черновики
*}
{extends file='layouts/layout.base.tpl'}
{extends 'layouts/layout.base.tpl'}
{block name='layout_options'}
{block 'layout_options'}
{$sNav = 'create'}
{/block}
{block name='layout_page_title'}{$aLang.topic_create}{/block}
{block 'layout_page_title'}
{$aLang.topic_create}
{/block}
{block name='layout_content'}
{include file='topics/topic_list.tpl'}
{block 'layout_content'}
{include 'components/topic/topic-list.tpl' topics=$aTopics paging=$aPaging}
{/block}

View file

@ -2,12 +2,12 @@
* Главная
*}
{extends file='layouts/layout.base.tpl'}
{extends 'layouts/layout.base.tpl'}
{block name='layout_options'}
{block 'layout_options'}
{$sNav = 'topics'}
{/block}
{block name='layout_content'}
{include file='topics/topic_list.tpl'}
{block 'layout_content'}
{include 'components/topic/topic-list.tpl' topics=$aTopics paging=$aPaging}
{/block}

View file

@ -2,12 +2,12 @@
* Список топиков из персональных блогов
*}
{extends file='layouts/layout.base.tpl'}
{extends 'layouts/layout.base.tpl'}
{block name='layout_options'}
{block 'layout_options'}
{$sNav = 'topics'}
{/block}
{block name='layout_content'}
{include file='topics/topic_list.tpl'}
{block 'layout_content'}
{include 'components/topic/topic-list.tpl' topics=$aTopics paging=$aPaging}
{/block}

View file

@ -10,5 +10,5 @@
{block 'layout_content' append}
{include 'navs/nav.user.created.tpl'}
{include 'topics/topic_list.tpl'}
{include 'components/topic/topic-list.tpl' topics=$aTopics paging=$aPaging}
{/block}

View file

@ -2,18 +2,18 @@
* Избранные топики пользователя
*}
{extends file='layouts/layout.user.tpl'}
{extends 'layouts/layout.user.tpl'}
{block name='layout_user_page_title'}
{block 'layout_user_page_title'}
{$aLang.user_menu_profile_favourites}
{/block}
{block name='layout_content' append}
{include file='navs/nav.user.favourite.tpl'}
{block 'layout_content' append}
{include 'navs/nav.user.favourite.tpl'}
{if $oUserCurrent and $oUserCurrent->getId() == $oUserProfile->getId()}
{insert name="block" block=tagsFavouriteTopic params={$aBlockParams.user=$oUserProfile}}
{/if}
{include file='topics/topic_list.tpl'}
{include 'components/topic/topic-list.tpl' topics=$aTopics paging=$aPaging}
{/block}

View file

@ -2,25 +2,25 @@
* Страница с формой поиска
*}
{extends file='layouts/layout.base.tpl'}
{extends 'layouts/layout.base.tpl'}
{block name='layout_options'}
{block 'layout_options'}
{$bNoSidebar = true}
{/block}
{block name='layout_page_title'}
{block 'layout_page_title'}
{$aLang.search.search}
{/block}
{block name='layout_content'}
{block 'layout_content'}
{include 'forms/search_forms/search_form.main.tpl'}
{include 'navs/nav.search.tpl'}
{if $aResultItems}
{if $sSearchType == 'topics'}
{include file='topics/topic_list.tpl' aTopics=$aResultItems}
{include 'components/topic/topic-list.tpl' topics=$aResultItems paging=$aPaging}
{elseif $sSearchType == 'comments'}
{include file='comments/comment_list.tpl' aComments=$aResultItems}
{include 'comments/comment_list.tpl' aComments=$aResultItems}
{else}
{hook run='search_result' sType=$sSearchType}
{/if}

View file

@ -10,5 +10,5 @@
{block 'layout_content'}
{include 'forms/search_forms/search_form.tags.tpl'}
{include 'topics/topic_list.tpl'}
{include 'components/topic/topic-list.tpl' topics=$aTopics paging=$aPaging}
{/block}

View file

@ -3,7 +3,7 @@
*
* @template topics/*.tpl
* @scripts <frontend>/common/js/topics.js
*
*
* @license GNU General Public License, version 2
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
* @author Denis Shakhov <denis.shakhov@gmail.com>
@ -20,48 +20,48 @@
/**
* Шапка
*/
.topic-header { margin-bottom: 25px; }
.article-header { margin-bottom: 25px; }
.topic-header .topic-title { font: 400 32px/1.3em "Open Sans", sans-serif; margin: 0 0 15px; }
.topic-header .topic-title a { text-decoration: none; }
.topic-header .topic-title a:visited { color: #000; }
.topic-header .topic-title i { position: relative; top: 8px; cursor: help; }
.article-header .article-title { font: 400 32px/1.3em "Open Sans", sans-serif; margin: 0 0 15px; }
.article-header .article-title a { text-decoration: none; }
.article-header .article-title a:visited { color: #000; }
.article-header .article-title i { position: relative; top: 8px; cursor: help; }
.topic-header .topic-info { color: #777; margin-bottom: 15px; overflow: hidden; }
.topic-header .topic-info-item { float: left; margin-right: 15px; }
.article-header .article-info { color: #777; margin-bottom: 15px; overflow: hidden; }
.article-header .article-info-item { float: left; margin-right: 15px; }
/**
* Содержимое топика
*/
.topic-content { margin-bottom: 20px; }
.topic-content.text { color: #333; font-size: 15px; line-height: 1.6em; }
.article-content { margin-bottom: 20px; }
.article-content.text { color: #333; font-size: 15px; line-height: 1.6em; }
/**
* Подвал
*/
.topic-footer .topic-info-item { float: left; padding: 8px; margin-right: 20px; }
.article-footer .article-info-item { float: left; padding: 8px; margin-right: 20px; }
.topic-info a { text-decoration: none; }
.topic-info a:hover { text-decoration: underline; }
.article-info a { text-decoration: none; }
.article-info a:hover { text-decoration: underline; }
/* Автор */
.topic-info-item.topic-info-item-author { padding: 2px; }
.topic-info-item .user-item-avatar-link:hover { text-decoration: none; }
.topic-info-item .user-item-avatar { width: 30px; height: 30px; }
.topic-info-item .user-item-name { color: #333; position: relative; top: 2px; /* TODO: Fix */; }
.article-info-item.article-info-item--author { padding: 2px; }
.article-info-item .user-item-avatar-link:hover { text-decoration: none; }
.article-info-item .user-item-avatar { width: 30px; height: 30px; }
.article-info-item .user-item-name { color: #333; position: relative; top: 2px; /* TODO: Fix */; }
/* Ссылка на комментарии */
.topic-info-item.topic-info-item-comments a span { color: #777; }
.article-info-item.article-info-item--comments a span { color: #777; }
/* Голосование */
.topic-info-item.topic-info-item-vote { padding: 0; }
.article-info-item.article-info-item--vote { padding: 0; }
/**
* Предпросмотр топика
*
*
* @template topics/topic_preview_X.tpl
*/
.topic-preview { margin-top: 30px; }

View file

@ -17,7 +17,7 @@
{block 'block_content'}
<span id="blog_user_count_{$oBlog->getId()}">{$oBlog->getCountUser()}</span>
{$oBlog->getCountUser()|declension:$aLang.blog.readers_declension}<br />
{$oBlog->getCountTopic()} {$oBlog->getCountTopic()|declension:$aLang.topic_declension}
{$oBlog->getCountTopic()} {lang name=$aLang.topic.topic_plural count=$oBlog->getCountTopic() plural=true}
<br />
<br />

View file

@ -97,7 +97,7 @@
{if $oUserCurrent}
{* Кнопка открывающая форму *}
<h4 class="comment-reply-root js-comment-reply js-comment-reply-root" data-id="0">
<a href="#" class="link-dotted">{$sNoticeCommentAdd}</a>
<a href="#" class="link-dotted">{$sNoticeCommentAdd|default:$aLang.comments.form.title}</a>
</h4>
{else}
{include 'components/alert/alert.tpl' sMods='info' mAlerts=$aLang.comments.alerts.unregistered}

View file

@ -13,7 +13,7 @@
{if $topics}
{* Список *}
<ul class="{$component}-topic-list js-{$component}-topic-list">
{include 'topics/topic_list.tpl' aTopics=$topics}
{include 'components/topic/topic-list.tpl' topics=$topics paging=$aPaging}
</ul>
{* Кнопка подгрузки *}

View file

@ -6,7 +6,7 @@
{if $aTags}
<ul class="tag-list tag-list-topic js-tags-topic-{$oTopic->getId()}" data-type="{$sTagsFavouriteType}" data-id="{$iTagsFavouriteId}">
<li class="tag-list-item tag-list-item-label">{$aLang.topic_tags}:</li>
<li class="tag-list-item tag-list-item-label">{$aLang.topic.tags}:</li>
{strip}
{foreach $aTags as $sTag}

View file

@ -0,0 +1,159 @@
{**
* Базовая форма создания топика
*
* @param object $topic
* @param object $type
* @param array $blogs
*}
{$topic = $smarty.local.topic}
{$type = $smarty.local.type}
{block name='add_topic_options'}{/block}
{hook run="add_topic_begin"}
{block name='add_topic_header_after'}{/block}
<form action="" method="POST" enctype="multipart/form-data" id="form-topic-add" class="js-form-validate" onsubmit="return false;">
{hook run="form_add_topic_begin"}
{block name='add_topic_form_begin'}{/block}
{* Выбор блога *}
{$items = [[
'value' => 0,
'text' => $aLang.topic.add.fields.blog.option_personal
]]}
{foreach $smarty.local.blogs as $blog}
{$items[] = [
'value' => $blog->getId(),
'text' => $blog->getTitle()
]}
{/foreach}
{include 'components/field/field.select.tpl'
sName = 'topic[blog_id]'
sLabel = $aLang.topic.add.fields.blog.label
sNote = $aLang.topic.add.fields.blog.note
sInputClasses = 'js-topic-add-title'
aItems = $items
sSelectedValue = {( $topic ) ? $topic->getBlogId() : '' }}
{* Заголовок топика *}
{include 'components/field/field.text.tpl'
sName = 'topic[topic_title]'
sValue = {(( $topic ) ? $topic->getTitle() : '')|escape:'html' }
sEntityField = 'topic_title'
sEntity = 'ModuleTopic_EntityTopic'
sLabel = $aLang.topic.add.fields.title.label}
{block name='add_topic_form_text_before'}{/block}
{* Текст топика *}
{if $type->getParam('allow_text')}
{include 'components/editor/editor.tpl'
sName = 'topic[topic_text_source]'
sValue = (( $topic ) ? $topic->getTextSource() : '')|escape
sLabel = $aLang.topic.add.fields.text.label
sEntityField = 'topic_text_source'
sEntity = 'ModuleTopic_EntityTopic'
sMediaTargetType = 'topic'
sMediaTargetId = ( $topic ) ? $topic->getId() : ''}
{/if}
{block name='add_topic_form_text_after'}{/block}
{* Теги *}
{if $type->getParam('allow_tags')}
{include 'components/field/field.text.tpl'
sName = 'topic[topic_tags]'
sValue = {(( $topic ) ? $topic->getTags() : '')|escape:'html' }
aRules = [ 'required' => true, 'rangetags' => '[1,15]' ]
sLabel = $aLang.topic.add.fields.tags.label
sNote = $aLang.topic.add.fields.tags.note
sClasses = 'width-full autocomplete-tags-sep'}
{/if}
{* Показывает дополнительные поля *}
{$params = [ [ 'target_type' => 'topic_'|cat:$type->getCode() ] ]}
{if $topic}
{$params[] = [ 'target_id' => $topic->getId() ]}
{/if}
{insert name="block" block="propertyUpdate" params=$params}
{* Вставка опросов *}
{if $type->getParam('allow_poll')}
{include 'components/poll/poll.manage.tpl'
sTargetType = 'topic'
sTargetId = ( $topic ) ? $topic->getId() : ''}
{/if}
{* Запретить комментарии *}
{include 'components/field/field.checkbox.tpl'
sName = 'topic[topic_forbid_comment]'
bChecked = {( $topic && $topic->getForbidComment() ) ? true : false }
sNote = $aLang.topic.add.fields.forbid_comments.note
sLabel = $aLang.topic.add.fields.forbid_comments.label}
{* Принудительный вывод топиков на главную (доступно только админам) *}
{if $oUserCurrent->isAdministrator()}
{include 'components/field/field.checkbox.tpl'
sName = 'topic[topic_publish_index]'
bChecked = {($topic && $topic->getPublishIndex()) ? true : false }
sNote = $aLang.topic.add.fields.publish_index.note
sLabel = $aLang.topic.add.fields.publish_index.label}
{/if}
{block name='add_topic_form_end'}{/block}
{hook run="form_add_topic_end"}
{* Скрытые поля *}
{include 'components/field/field.hidden.tpl' sName='topic_type' sValue=$type->getCode()}
{if $topic}
{include "components/field/field.hidden.tpl" sName='topic[id]' sValue=$topic->getId()}
{/if}
{**
* Кнопки
*}
{* Опубликовать / Сохранить изменения *}
{include 'components/button/button.tpl'
sId = {( $topic ) ? 'submit-edit-topic-publish' : 'submit-add-topic-publish' }
sMods = 'primary'
sClasses = 'fl-r'
sText = $aLang.topic.add.button[ ( $sEvent == 'add' or ( $topic and $topic->getPublish() == 0 ) ) ? 'publish' : 'update' ]}
{* Превью *}
{include 'components/button/button.tpl' sType='button' sClasses='js-topic-preview-text-button' sText=$aLang.common.preview_text}
{* Сохранить в черновиках / Перенести в черновики *}
{if $topic->getPublish() != 0}
{include 'components/button/button.tpl'
sId = {( $topic ) ? 'submit-edit-topic-save' : 'submit-add-topic-save' }
sText = $aLang.topic.add.button[ ( $sEvent == 'add' ) ? 'save_as_draft' : 'mark_as_draft' ]}
{/if}
</form>
{* Блок с превью текста *}
<div class="topic-preview" style="display: none;" id="topic-text-preview"></div>
{block name='add_topic_end'}{/block}
{hook run="add_topic_end"}

View file

@ -0,0 +1,20 @@
{**
* Список топиков
*
* @param array $topics
* @param array $paging
*}
{$topics = $smarty.local.topics}
{if $topics}
{add_block group='toolbar' name='toolbar/toolbar.topic.tpl' show=count( $topics )}
{foreach $topics as $topic}
{include './topic-type.tpl' topic=$topic isList=true}
{/foreach}
{include 'components/pagination/pagination.tpl' aPaging=$smarty.local.paging sClasses='js-pagination-topics'}
{else}
{include 'components/alert/alert.tpl' mAlerts=$aLang.common.empty sMods='empty'}
{/if}

View file

@ -0,0 +1,22 @@
{**
* Предпросмотр топика
*
* @styles css/topic.css
*}
{$oUser = $oTopic->getUser()}
<h3 class="profile-page-header">{$aLang.common.preview_text}</h3>
{include './topic-type.tpl' topic=$oTopic}
{* TODO: Пофиксить кнопки сабмита *}
<button type="submit" name="submit_topic_publish" class="button button-primary fl-r" onclick="jQuery('#submit_topic_publish').trigger('click');">
{if $sEvent == 'add' or ($oTopicEdit and $oTopicEdit->getPublish() == 0)}
{$aLang.topic_create_submit_publish}
{else}
{$aLang.topic_create_submit_update}
{/if}
</button>
<button type="button" name="submit_preview" class="button js-topic-preview-text-hide-button">{$aLang.common.cancel}</button>
<button type="submit" name="submit_topic_save" class="button" onclick="jQuery('#submit_topic_save').trigger('click');">{$aLang.topic_create_submit_save}</button>

View file

@ -0,0 +1,20 @@
{**
* Подключение шаблона топика определенного типа
*
* @param object $topic
*}
{$topic = $smarty.local.topic}
{$type = $topic->getType()}
{if $LS->Topic_IsAllowTopicType( $type )}
{$template = "./topic.type.{$type}.tpl"}
{* Если для указанного типа существует шаблон, то подключаем его *}
{* Иначе подключаем дефолтный шаблон топика *}
{if ! $LS->Viewer_TemplateExists( $template )}
{$template = './topic.tpl'}
{/if}
{include "$template" topic=$topic isList=$smarty.local.isList}
{/if}

View file

@ -0,0 +1,125 @@
{**
* Базовый шаблон топика
*
* @param object $topic
*
* @styles assets/css/topic.css
* @scripts <framework>/js/livestreet/topic.js
*}
{extends 'components/article/article.tpl'}
{block 'article_options' prepend}
{$article = $smarty.local.topic}
{$topic = $article}
{$type = 'topic'}
{$smarty.block.parent}
{$classes = "{$classes} topic"}
{/block}
{* Иконки в заголовке топика *}
{block 'article_title' prepend}
{if $topic->getPublish() == 0}
<i class="icon-file" title="{$aLang.topic.is_draft}"></i>
{/if}
{/block}
{* Название блога *}
{block 'article_header_info' prepend}
{$blog = $topic->getBlog()}
<li class="{$component}-info-item {$component}-info-item--blog">
<a href="{$blog->getUrlFull()}">{$blog->getTitle()|escape}</a>
</li>
{/block}
{* Название блога *}
{block 'article_body' append}
{* Дополнительные поля *}
{block 'topic_content_properties'}
{if ! $isList}
{$properties = $topic->property->getPropertyList()}
{$info = []}
{foreach $properties as $property}
{$mValue = $property->getValue()->getValueForDisplay()}
{$info[] = [
'label' => $property->getTitle(),
'content' => $property->getValue()->getValueForDisplay()
]}
{/foreach}
{include 'components/info_list/info_list.tpl' aInfoList=$info}
{/if}
{/block}
{* Опросы *}
{block 'topic_content_polls'}
{if ! $isList}
{include 'components/poll/poll.list.tpl' polls=$topic->getPolls()}
{/if}
{/block}
{/block}
{* Теги *}
{block 'article_footer'}
{if ! $isList and $topic->getTypeObject()->getParam('allow_tags')}
{$favourite = $topic->getFavourite()}
{include 'components/tags/tag_list.tpl'
aTags = $topic->getTagsArray()
bTagsUseFavourite = true
aTagsFavourite = ($favourite) ? $favourite->getTagsArray() : []
sTagsFavouriteType = 'topic'
iTagsFavouriteId = $topic->getId()}
{/if}
{$smarty.block.parent}
{* Всплывающий блок появляющийся при нажатии на кнопку Поделиться *}
<div class="tooltip" id="topic_share_{$topic->getId()}">
<div class="tooltip-content js-tooltip-content">
{hookb run="topic_share" topic=$topic isList=$isList}
<div class="yashare-auto-init" data-yashareTitle="{$topic->getTitle()|escape}" data-yashareLink="{$topic->getUrl()}" data-yashareL10n="ru" data-yashareType="button" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,gplus"></div>
{/hookb}
</div>
</div>
{/block}
{* Информация *}
{block 'article_footer_info_items'}
{* Голосование *}
<li class="{$component}-info-item {$component}-info-item--vote">
{$isExpired = strtotime($topic->getDateAdd()) < $smarty.now - Config::Get('acl.vote.topic.limit_time')}
{include 'components/vote/vote.tpl'
oObject = $topic
sClasses = 'js-vote-topic'
sMods = 'small white topic'
bUseAbstain = true
bIsLocked = ( $oUserCurrent && $topic->getUserId() == $oUserCurrent->getId() ) || $isExpired
bShowRating = $topic->getVote() || ($oUserCurrent && $topic->getUserId() == $oUserCurrent->getId()) || $isExpired}
</li>
{$smarty.block.parent}
{if ! $isList}
{* Избранное *}
<li class="{$component}-info-item {$component}-info-item--favourite">
{include 'components/favourite/favourite.tpl' sClasses="js-favourite-{$type}" oObject=$article}
</li>
{* Поделиться *}
<li class="{$component}-info-item {$component}-info-item--share">
<a href="#" class="icon-share js-popover-default" title="{$aLang.topic.share}" data-tooltip-target="#topic_share_{$topic->getId()}"></a>
</li>
{/if}
{/block}

View file

@ -1,166 +0,0 @@
{**
* Базовая форма создания топика
*
* @styles css/topic.css
*}
{extends file='layouts/layout.base.tpl'}
{block name='layout_options'}
{if $sEvent == 'add'}
{$sNav = 'create'}
{/if}
{/block}
{block name='layout_page_title'}
{if $sEvent == 'add'}
{$aLang.topic_create}
{else}
{$aLang.topic_topic_edit}
{/if}
{/block}
{block name='layout_content'}
{block name='add_topic_options'}{/block}
{hook run="add_topic_begin"}
{block name='add_topic_header_after'}{/block}
<form action="" method="POST" enctype="multipart/form-data" id="form-topic-add" class="js-form-validate" onsubmit="return false;">
{hook run="form_add_topic_begin"}
{block name='add_topic_form_begin'}{/block}
{* Выбор блога *}
{$aBlogs[] = [
'value' => 0,
'text' => $aLang.topic_create_blog_personal
]}
{foreach $aBlogsAllow as $oBlog}
{$aBlogs[] = [
'value' => $oBlog->getId(),
'text' => $oBlog->getTitle()
]}
{/foreach}
{include file='components/field/field.select.tpl'
sName = 'topic[blog_id]'
sLabel = $aLang.topic_create_blog
sNote = $aLang.topic_create_blog_notice
sInputClasses = 'js-topic-add-title'
aItems = $aBlogs
sSelectedValue = {($oTopicEdit) ? $oTopicEdit->getBlogId() : '' }}
{* Заголовок топика *}
{include file='components/field/field.text.tpl'
sName = 'topic[topic_title]'
sValue = {(($oTopicEdit) ? $oTopicEdit->getTitle() : '')|escape:'html' }
sEntityField = 'topic_title'
sEntity = 'ModuleTopic_EntityTopic'
sNote = $aLang.topic_create_title_notice
sLabel = $aLang.topic_create_title}
{block name='add_topic_form_text_before'}{/block}
{* Текст топика *}
{if $oTopicType->getParam('allow_text')}
{include 'components/editor/editor.tpl'
sName = 'topic[topic_text_source]'
sValue = (($oTopicEdit) ? $oTopicEdit->getTextSource() : '')|escape
sLabel = $aLang.topic_create_text
sEntityField = 'topic_text_source'
sEntity = 'ModuleTopic_EntityTopic'
sMediaTargetType = 'topic'
sMediaTargetId = ($oTopicEdit) ? $oTopicEdit->getId() : ''}
{/if}
{block name='add_topic_form_text_after'}{/block}
{* Теги *}
{if $oTopicType->getParam('allow_tags')}
{include file='components/field/field.text.tpl'
sName = 'topic[topic_tags]'
sValue = {(($oTopicEdit) ? $oTopicEdit->getTags() : '')|escape:'html' }
aRules = [ 'required' => true, 'rangetags' => '[1,15]' ]
sNote = $aLang.topic_create_tags_notice
sLabel = $aLang.topic_create_tags
sClasses = 'width-full autocomplete-tags-sep'}
{/if}
{* Показывает дополнительные поля *}
{$aBlockParams = []}
{$aBlockParams.target_type = 'topic_'|cat:$oTopicType->getCode()}
{if $oTopicEdit}
{$aBlockParams.target_id = $oTopicEdit->getId()}
{/if}
{insert name="block" block="propertyUpdate" params=$aBlockParams}
{* Вставка опросов *}
{if $oTopicType->getParam('allow_poll')}
{include file='components/poll/poll.manage.tpl'
sTargetType = 'topic'
sTargetId = ($oTopicEdit) ? $oTopicEdit->getId() : ''}
{/if}
{* Запретить комментарии *}
{include file='components/field/field.checkbox.tpl'
sName = 'topic[topic_forbid_comment]'
bChecked = {($oTopicEdit && $oTopicEdit->getForbidComment()) ? true : false }
sNote = $aLang.topic_create_forbid_comment_notice
sLabel = $aLang.topic_create_forbid_comment}
{* Принудительный вывод топиков на главную (доступно только админам) *}
{if $oUserCurrent->isAdministrator()}
{include file='components/field/field.checkbox.tpl'
sName = 'topic[topic_publish_index]'
bChecked = {($oTopicEdit && $oTopicEdit->getPublishIndex()) ? true : false }
sNote = $aLang.topic_create_publish_index_notice
sLabel = $aLang.topic_create_publish_index}
{/if}
{block name='add_topic_form_end'}{/block}
{hook run="form_add_topic_end"}
{* Скрытые поля *}
{include file='components/field/field.hidden.tpl' sName='topic_type' sValue=$oTopicType->getCode()}
{* Кнопки *}
{if $sEvent == 'add' or ($oTopicEdit and $oTopicEdit->getPublish() == 0)}
{$sSubmitInputText = $aLang.topic_create_submit_publish}
{else}
{$sSubmitInputText = $aLang.topic_create_submit_update}
{/if}
{if $oTopicEdit}
{include file="components/field/field.hidden.tpl" sName='topic[id]' sValue=$oTopicEdit->getId()}
{/if}
{include file='components/button/button.tpl'
sId = {($oTopicEdit) ? 'submit-edit-topic-publish' : 'submit-add-topic-publish' }
sMods = 'primary'
sClasses = 'fl-r'
sText = $sSubmitInputText}
{include file='components/button/button.tpl' sType='button' sClasses='js-topic-preview-text-button' sText=$aLang.topic_create_submit_preview}
{include file='components/button/button.tpl' sId={($oTopicEdit) ? 'submit-edit-topic-save' : 'submit-add-topic-save' } sText=$aLang.topic_create_submit_save}
</form>
{* Блок с превью текста *}
<div class="topic-preview" style="display: none;" id="topic-text-preview"></div>
{block name='add_topic_end'}{/block}
{hook run="add_topic_end"}
{/block}

View file

@ -27,7 +27,7 @@
{/foreach}
{modal_create_item sName='blog' sTitle=$aLang.block_create_blog}
{modal_create_item sName='talk' sTitle=$aLang.block_create_talk}
{modal_create_item sName='draft' url="{router page='content'}drafts/" sTitle="{$aLang.topic_menu_drafts} {if $iUserCurrentCountTopicDraft}({$iUserCurrentCountTopicDraft}){/if}"}
{modal_create_item sName='draft' url="{router page='content'}drafts/" sTitle="{$aLang.topic.drafts} {if $iUserCurrentCountTopicDraft}({$iUserCurrentCountTopicDraft}){/if}"}
{hook run='write_item' isPopup=true}
</ul>

View file

@ -9,7 +9,7 @@
{block name='modal_id'}favourite-form-tags{/block}
{block name='modal_class'}modal-favourite-tags js-modal-default{/block}
{block name='modal_title'}{$aLang.add_favourite_tags}{/block}
{block name='modal_title'}{$aLang.topic.add_favourite_tags}{/block}
{block name='modal_content'}
<form id="js-favourite-form">

View file

@ -9,7 +9,7 @@
{$aItems[] = [ 'name' => $oTopicType->getCode(), 'url' => $oTopicType->getUrlForAdd(), 'text' => $oTopicType->getName() ]}
{/foreach}
{$aItems[] = [ 'name' => 'drafts', 'url' => "{router page='content'}drafts/", 'text' => $aLang.topic_menu_drafts, 'count' => $iUserCurrentCountTopicDraft ]}
{$aItems[] = [ 'name' => 'drafts', 'url' => "{router page='content'}drafts/", 'text' => $aLang.topic.drafts, 'count' => $iUserCurrentCountTopicDraft ]}
{include 'components/nav/nav.tpl'
sName = 'create'

View file

@ -1,5 +1,5 @@
{include 'components/nav/nav.tpl' sName='main' sActiveItem=$sMenuHeadItemSelect sMods='main' aItems=[
[ 'text' => $aLang.topic_title, 'url' => {router page='/'}, 'name' => 'blog' ],
[ 'text' => $aLang.topic.topics, 'url' => {router page='/'}, 'name' => 'blog' ],
[ 'text' => $aLang.blog.blogs, 'url' => {router page='blogs'}, 'name' => 'blogs' ],
[ 'text' => $aLang.people, 'url' => {router page='people'}, 'name' => 'people' ],
[ 'text' => $aLang.activity.title, 'url' => {router page='stream'}, 'name' => 'stream' ]

View file

@ -8,7 +8,7 @@
sMods = 'pills'
aHookArguments = [ 'oUserProfile' => $oUserProfile ]
aItems = [
[ 'name' => 'topics', 'url' => "{$oUserProfile->getUserWebPath()}created/topics/", 'text' => $aLang.topic_title, 'count' => $iCountTopicUser ],
[ 'name' => 'topics', 'url' => "{$oUserProfile->getUserWebPath()}created/topics/", 'text' => $aLang.topic.topics, 'count' => $iCountTopicUser ],
[ 'name' => 'comments', 'url' => "{$oUserProfile->getUserWebPath()}created/comments/", 'text' => $aLang.user_menu_publication_comment, 'count' => $iCountCommentUser ],
[ 'name' => 'notes', 'url' => "{$oUserProfile->getUserWebPath()}created/notes/", 'text' => $aLang.user_menu_profile_notes, 'count' => $iCountNoteUser, 'is_enabled' => $oUserCurrent and $oUserCurrent->getId() == $oUserProfile->getId() ]
]}

View file

@ -11,7 +11,7 @@
{block 'toolbar_item_options' append}
{$_sMods = 'topic'}
{$_sClasses = 'js-toolbar-topics'}
{$_bShow = $params.iCountTopic}
{$_bShow = $params.show}
{/block}
{block 'toolbar_item'}

View file

@ -1,14 +0,0 @@
{**
* Топик
*}
{if $LS->Topic_IsAllowTopicType($oTopic->getType())}
{if $LS->Topic_IsAllowTopicType($oTopic->getType())}
{$sTemplateType="topics/topic.type.{$oTopic->getType()}.tpl"}
{if $LS->Viewer_TemplateExists($sTemplateType)}
{include file=$sTemplateType}
{else}
{include file="topics/topic_base.tpl"}
{/if}
{/if}
{/if}

View file

@ -1,113 +0,0 @@
{**
* Базовый шаблон топика
*
* @styles assets/css/topic.css
* @scripts <framework>/js/livestreet/topic.js
*}
{extends 'components/article/article.tpl'}
{block 'entry_options'}
{$oEntry = $oTopic}
{$sEntryType = 'topic'}
{$oBlog = $oTopic->getBlog()}
{$oFavourite = $oTopic->getFavourite()}
{$oTopicType = $oTopic->getTypeObject()}
{/block}
{* Иконки в заголовке топика *}
{block 'entry_title' prepend}
{if $oTopic->getPublish() == 0}
<i class="icon-file" title="{$aLang.topic_unpublish}"></i>
{/if}
{/block}
{* Название блога *}
{block 'entry_header_info' prepend}
<li class="topic-info-item topic-info-item-blog">
<a href="{$oBlog->getUrlFull()}">{$oBlog->getTitle()|escape}</a>
</li>
{/block}
{* Название блога *}
{block 'entry_body' append}
{* Дополнительные поля *}
{block name='topic_content_properties'}
{if ! $bTopicList}
{$aProperties = $oTopic->property->getPropertyList()}
{$aInfoList = []}
{foreach $aProperties as $oProperty}
{$mValue = $oProperty->getValue()->getValueForDisplay()}
{$aInfoList[] = [
'label' => $oProperty->getTitle(),
'content' => $oProperty->getValue()->getValueForDisplay()
]}
{/foreach}
{include 'components/info_list/info_list.tpl' aInfoList=$aInfoList}
{/if}
{/block}
{* Опросы *}
{block name='topic_content_polls'}
{if ! $bTopicList}
{include file='components/poll/poll.list.tpl' polls=$oTopic->getPolls()}
{/if}
{/block}
{/block}
{* Теги *}
{block 'entry_footer'}
{if ! $bTopicList and $oTopicType->getParam('allow_tags')}
{include 'components/tags/tag_list.tpl'
aTags = $oTopic->getTagsArray()
bTagsUseFavourite = true
aTagsFavourite = ($oFavourite) ? $oFavourite->getTagsArray() : []
sTagsFavouriteType = 'topic'
iTagsFavouriteId = $oTopic->getId()}
{/if}
{$smarty.block.parent}
{* Всплывающий блок появляющийся при нажатии на кнопку Поделиться *}
<div class="tooltip" id="topic_share_{$oTopic->getId()}">
<div class="tooltip-content js-tooltip-content">
{hookb run="topic_share" topic=$oTopic bTopicList=$bTopicList}
<div class="yashare-auto-init" data-yashareTitle="{$oTopic->getTitle()|escape}" data-yashareLink="{$oTopic->getUrl()}" data-yashareL10n="ru" data-yashareType="button" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,gplus"></div>
{/hookb}
</div>
</div>
{/block}
{* Информация *}
{block 'entry_footer_info_items'}
{* Голосование *}
<li class="topic-info-item topic-info-item-vote">
{$isExpired = strtotime($oTopic->getDateAdd()) < $smarty.now - Config::Get('acl.vote.topic.limit_time')}
{include 'components/vote/vote.tpl'
oObject = $oTopic
sClasses = 'js-vote-topic'
sMods = 'small white topic'
bUseAbstain = true
bIsLocked = ( $oUserCurrent && $oTopic->getUserId() == $oUserCurrent->getId() ) || $isExpired
bShowRating = $oTopic->getVote() || ($oUserCurrent && $oTopic->getUserId() == $oUserCurrent->getId()) || $isExpired}
</li>
{$smarty.block.parent}
{if ! $bTopicList}
{* Поделиться *}
<li class="topic-info-item topic-info-item-share">
<a href="#" class="icon-share js-popover-default" title="{$aLang.topic_share}" data-tooltip-target="#topic_share_{$oTopic->getId()}"></a>
</li>
{/if}
{/block}

View file

@ -1,23 +0,0 @@
{**
* Список топиков
*}
{if $aTopics}
{add_block group='toolbar' name='toolbar/toolbar.topic.tpl' iCountTopic=count($aTopics)}
{foreach $aTopics as $oTopic}
{if $LS->Topic_IsAllowTopicType($oTopic->getType())}
{$sTemplateType = "topics/topic.type.{$oTopic->getType()}.tpl"}
{if $LS->Viewer_TemplateExists($sTemplateType)}
{include file=$sTemplateType bTopicList=true}
{else}
{include 'topics/topic_base.tpl' bTopicList=true}
{/if}
{/if}
{/foreach}
{include 'components/pagination/pagination.tpl' aPaging=$aPaging sClasses='js-pagination-topics'}
{else}
{include 'components/alert/alert.tpl' mAlerts=$aLang.blog_no_topic sMods='empty'}
{/if}

View file

@ -1,71 +0,0 @@
{**
* Предпросмотр топика
*
* @styles css/topic.css
*}
{$oUser = $oTopic->getUser()}
<h3 class="profile-page-header">{$aLang.topic_preview}</h3>
<article class="topic topic-type-{$oTopic->getType()}">
<header class="topic-header">
<h1 class="topic-title">
{$oTopic->getTitle()|escape:'html'}
</h1>
<div class="topic-info">
<time datetime="{date_format date=$oTopic->getDateAdd() format='c'}" pubdate title="{date_format date=$oTopic->getDateAdd() format='j F Y, H:i'}">
{date_format date=$oTopic->getDateAdd() format="j F Y, H:i"}
</time>
</div>
</header>
<div class="topic-content text">
{hook run='topic_preview_content_begin' topic=$oTopic}
{$oTopic->getText()}
{hook run='topic_preview_content_end' topic=$oTopic}
</div>
<footer class="topic-footer">
<ul class="tag-list tag-list-topic">
<li class="tag-list-item tag-list-item-label">{$aLang.topic_tags}:</li>
{strip}
{foreach $oTopic->getTagsArray() as $sTag}
<li class="tag-list-item tag-list-item-tag">
{if ! $sTag@first}, {/if}<a rel="tag" href="{router page='tag'}{$sTag|escape:'url'}/">{$sTag|escape}</a>
</li>
{foreachelse}
<li class="tag-list-item tag-list-item-empty">{$aLang.topic_tags_empty}</li>
{/foreach}
{/strip}
</ul>
<ul class="topic-info clearfix">
{* Автор топика *}
<li class="topic-info-item topic-info-item-author">
<a href="{$oUser->getUserWebPath()}">
<img src="{$oUser->getProfileAvatarPath(48)}" alt="{$oUser->getDisplayName()}" class="topic-info-item-author-avatar" />
</a>
<a rel="author" href="{$oUser->getUserWebPath()}" class="topic-info-item-author-login">{$oUser->getDisplayName()}</a>
</li>
{hook run='topic_preview_show_info' topic=$oTopic}
</ul>
{hook run='topic_preview_show_end' topic=$oTopic}
</footer>
</article>
{* TODO: Пофиксить кнопки сабмита *}
<button type="submit" name="submit_topic_publish" class="button button-primary fl-r" onclick="jQuery('#submit_topic_publish').trigger('click');">
{if $sEvent == 'add' or ($oTopicEdit and $oTopicEdit->getPublish() == 0)}
{$aLang.topic_create_submit_publish}
{else}
{$aLang.topic_create_submit_update}
{/if}
</button>
<button type="button" name="submit_preview" class="button js-topic-preview-text-hide-button">{$aLang.topic_create_submit_preview_close}</button>
<button type="submit" name="submit_topic_save" class="button" onclick="jQuery('#submit_topic_save').trigger('click');">{$aLang.topic_create_submit_save}</button>