mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
Доработка компонента report
This commit is contained in:
parent
ca8e7acd76
commit
dc111bd39e
|
@ -134,7 +134,20 @@ class ActionProfile extends Action
|
|||
return parent::EventNotFound();
|
||||
}
|
||||
|
||||
/**
|
||||
* Получаем список типов жалоб
|
||||
*/
|
||||
$types = array();
|
||||
|
||||
foreach ( Config::Get('module.user.complaint_type') as $type ) {
|
||||
$types[] = array(
|
||||
'value' => $type,
|
||||
'text' => $this->Lang_Get( 'user.report.types.' . $type )
|
||||
);
|
||||
}
|
||||
|
||||
$oViewer = $this->Viewer_GetLocalViewer();
|
||||
$oViewer->Assign('types', $types, true);
|
||||
$this->Viewer_AssignAjax('sText', $oViewer->Fetch("components/report/modal.report.tpl"));
|
||||
}
|
||||
|
||||
|
@ -154,7 +167,7 @@ class ActionProfile extends Action
|
|||
* Создаем жалобу и проводим валидацию
|
||||
*/
|
||||
$oComplaint = Engine::GetEntity('ModuleUser_EntityComplaint');
|
||||
$oComplaint->setTargetUserId(getRequestStr('user_id'));
|
||||
$oComplaint->setTargetUserId(getRequestStr('target_id'));
|
||||
$oComplaint->setUserId($this->oUserCurrent->getId());
|
||||
$oComplaint->setText(getRequestStr('text'));
|
||||
$oComplaint->setType(getRequestStr('type'));
|
||||
|
|
|
@ -1151,6 +1151,14 @@ return array(
|
|||
'was_online_male' => 'Заходил %%date%%',
|
||||
'was_online_female' => 'Заходила %%date%%'
|
||||
),
|
||||
// Жалоба
|
||||
'report' => array(
|
||||
'types' => array(
|
||||
'spam' => 'Спам',
|
||||
'obscene' => 'Непристойное поведение',
|
||||
'other' => 'Другое'
|
||||
)
|
||||
),
|
||||
// Друзья
|
||||
'friends' => array(
|
||||
'title' => 'Друзья',
|
||||
|
@ -1542,14 +1550,8 @@ return array(
|
|||
),
|
||||
'submit' => '___common.send___'
|
||||
),
|
||||
// TODO: Move to 'user'
|
||||
'type_list' => array(
|
||||
'spam' => 'Спам',
|
||||
'obscene' => 'Непристойное поведение',
|
||||
'other' => 'Другое',
|
||||
),
|
||||
'notices' => array(
|
||||
'target_error' => 'Неверный пользователь для жалобы', // TODO: Move to 'user'
|
||||
'target_error' => 'Неверный id объекта', // TODO: Remove?
|
||||
'error_type' => 'Неверный тип жалобы', // TODO: Remove?
|
||||
'success' => 'Ваша жалоба отправлена администрации',
|
||||
)
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/**
|
||||
* Report
|
||||
*
|
||||
* @module ls/report
|
||||
*
|
||||
* @license GNU General Public License, version 2
|
||||
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
|
||||
* @author Denis Shakhov <denis.shakhov@gmail.com>
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
"use strict";
|
||||
|
||||
$.widget( "livestreet.lsReport", {
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
options: {
|
||||
params: {},
|
||||
|
||||
// Ссылки
|
||||
urls: {
|
||||
modal: null,
|
||||
add: null,
|
||||
},
|
||||
|
||||
// Селекторы
|
||||
selectors: {
|
||||
form: 'form'
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Конструктор
|
||||
*
|
||||
* @constructor
|
||||
* @private
|
||||
*/
|
||||
_create: function () {
|
||||
this.option( 'params', $.extend( {}, this.option( 'params' ), ls.utils.getDataOptions( this.element, 'param' ) ) );
|
||||
|
||||
this._on({ click: this.showModal });
|
||||
},
|
||||
|
||||
/**
|
||||
* Показывает модальное окно с формой
|
||||
*/
|
||||
showModal: function( event ) {
|
||||
var _this = this, form;
|
||||
|
||||
ls.modal.load( this.option( 'urls.modal' ), this.option( 'params' ), {
|
||||
aftershow: function ( e, modal ) {
|
||||
form = modal.element.find( _this.option( 'selectors.form' ) );
|
||||
|
||||
// Отправка формы
|
||||
form.on( 'submit', function ( event ) {
|
||||
ls.ajax.submit( _this.option( 'urls.add' ), form, function( response ) {
|
||||
modal.hide();
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
},
|
||||
afterhide: function () {
|
||||
form.off();
|
||||
form = null;
|
||||
},
|
||||
center: false
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
|
@ -1,34 +1,27 @@
|
|||
{**
|
||||
* Жалоба на пользователя
|
||||
*
|
||||
* TODO: Универсализировать
|
||||
* @param array $types
|
||||
*}
|
||||
|
||||
{extends 'components/modal/modal.tpl'}
|
||||
|
||||
{block 'modal_id'}modal-complaint-user{/block}
|
||||
{block 'modal_class'}modal-complaint-user js-modal-default{/block}
|
||||
{block 'modal_title'}{lang name='report.form.title'}{/block}
|
||||
{block 'modal_title'}{lang 'report.form.title'}{/block}
|
||||
|
||||
{block 'modal_content'}
|
||||
<form action="" method="post" onsubmit="return false;" id="form-complaint-user">
|
||||
{foreach Config::Get('module.user.complaint_type') as $type}
|
||||
{$aTypes[] = [
|
||||
'value' => $type,
|
||||
'text' => $aLang.report.type_list.{$type}
|
||||
]}
|
||||
{/foreach}
|
||||
|
||||
<form action="" method="post" id="form-complaint-user">
|
||||
{include 'components/field/field.select.tpl'
|
||||
name = 'type'
|
||||
label = {lang name='report.form.fields.type.label'}
|
||||
label = {lang 'report.form.fields.type.label'}
|
||||
classes = 'width-full'
|
||||
items = $aTypes}
|
||||
items = $smarty.local.types}
|
||||
|
||||
{include 'components/field/field.textarea.tpl'
|
||||
name = 'text'
|
||||
rows = 5
|
||||
label = {lang name='report.form.fields.text.label'}
|
||||
label = {lang 'report.form.fields.text.label'}
|
||||
classes = 'width-full'}
|
||||
|
||||
{* Каптча *}
|
||||
|
@ -38,7 +31,7 @@
|
|||
name = 'captcha'}
|
||||
{/if}
|
||||
|
||||
{include 'components/field/field.hidden.tpl' name='user_id' value=$_aRequest.user_id}
|
||||
{include 'components/field/field.hidden.tpl' name='target_id' value=$_aRequest.target_id}
|
||||
</form>
|
||||
{/block}
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
{* Пожаловаться *}
|
||||
<li>
|
||||
<a href="#" data-type="modal-toggle" data-modal-url="{router page='profile/ajax-modal-complaint'}" data-param-user_id="{$user->getId()}">{lang 'user.actions.report'}</a>
|
||||
<a href="#" class="js-user-report" data-param-target_id="{$user->getId()}">
|
||||
{lang 'user.actions.report'}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
Loading…
Reference in a new issue