mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-16 23:00:51 +03:00
Универсальный пополняемый список пользователей
This commit is contained in:
parent
10e04cdb5e
commit
c6cf1ab756
|
@ -1352,8 +1352,8 @@ class ActionBlog extends Action {
|
|||
* Устанавливаем формат Ajax ответа
|
||||
*/
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
$sUsers=getRequest('users',null,'post');
|
||||
$sBlogId=getRequestStr('idBlog',null,'post');
|
||||
$sUsers=getRequest('sUserList',null,'post');
|
||||
$sBlogId=getRequestStr('iTargetId',null,'post');
|
||||
/**
|
||||
* Если пользователь не авторизирован, возвращаем ошибку
|
||||
*/
|
||||
|
@ -1439,6 +1439,9 @@ class ActionBlog extends Action {
|
|||
$oBlogUserNew->setUserRole(ModuleBlog::BLOG_USER_ROLE_INVITE);
|
||||
|
||||
if($this->Blog_AddRelationBlogUser($oBlogUserNew)) {
|
||||
$oViewer = $this->Viewer_GetLocalViewer();
|
||||
$oViewer->Assign('oUser', $oUser);
|
||||
|
||||
$aResult[]=array(
|
||||
'bStateError'=>false,
|
||||
'sMsgTitle'=>$this->Lang_Get('attention'),
|
||||
|
@ -1446,7 +1449,8 @@ class ActionBlog extends Action {
|
|||
'sUserLogin'=>htmlspecialchars($sUser),
|
||||
'sUserWebPath'=>$oUser->getUserWebPath(),
|
||||
'sUserAvatar48'=>$oUser->getProfileAvatarPath(48),
|
||||
'iUserId'=>$oUser->getId()
|
||||
'iUserId'=>$oUser->getId(),
|
||||
'sUserHtml'=>$oViewer->Fetch("user_list_small_item.blog_invite.tpl")
|
||||
);
|
||||
$this->SendBlogInvite($oBlog,$oUser);
|
||||
} else {
|
||||
|
@ -1549,8 +1553,8 @@ class ActionBlog extends Action {
|
|||
* Устанавливаем формат Ajax ответа
|
||||
*/
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
$sUserId=getRequestStr('idUser',null,'post');
|
||||
$sBlogId=getRequestStr('idBlog',null,'post');
|
||||
$sUserId=getRequestStr('iUserId',null,'post');
|
||||
$sBlogId=getRequestStr('iTargetId',null,'post');
|
||||
/**
|
||||
* Если пользователь не авторизирован, возвращаем ошибку
|
||||
*/
|
||||
|
|
|
@ -87,7 +87,6 @@ class ActionStream extends Action {
|
|||
return parent::EventNotFound();
|
||||
}
|
||||
$this->Viewer_AddBlock('right','activitySettings');
|
||||
$this->Viewer_AddBlock('right','activityFriends');
|
||||
$this->Viewer_AddBlock('right','activityUsers');
|
||||
|
||||
/**
|
||||
|
|
|
@ -499,7 +499,7 @@ class ActionTalk extends Action {
|
|||
str_replace(
|
||||
'login',
|
||||
$oUser->getLogin(),
|
||||
$this->Lang_Get('talk_user_in_blacklist',array('login'=>htmlspecialchars($oUser->getLogin())))
|
||||
$this->Lang_Get('messages.blacklist.alerts.blocked',array('login'=>htmlspecialchars($oUser->getLogin())))
|
||||
),
|
||||
$this->Lang_Get('error')
|
||||
);
|
||||
|
@ -719,7 +719,7 @@ class ActionTalk extends Action {
|
|||
* Устанавливаем формат Ajax ответа
|
||||
*/
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
$sUsers=getRequestStr('users',null,'post');
|
||||
$sUsers=getRequestStr('sUserList',null,'post');
|
||||
/**
|
||||
* Если пользователь не авторизирован, возвращаем ошибку
|
||||
*/
|
||||
|
@ -760,14 +760,18 @@ class ActionTalk extends Action {
|
|||
if ($oUser=$this->User_GetUserByLogin($sUser) and $oUser->getActivate()==1) {
|
||||
if(!isset($aUserBlacklist[$oUser->getId()])) {
|
||||
if($this->Talk_AddUserToBlackList($oUser->getId(),$this->oUserCurrent->getId())) {
|
||||
$oViewer = $this->Viewer_GetLocalViewer();
|
||||
$oViewer->Assign('oUser', $oUser);
|
||||
|
||||
$aResult[]=array(
|
||||
'bStateError'=>false,
|
||||
'sMsgTitle'=>$this->Lang_Get('attention'),
|
||||
'sMsg'=>$this->Lang_Get('talk_blacklist_add_ok',array('login'=>htmlspecialchars($sUser))),
|
||||
'sMsg'=>$this->Lang_Get('common.success.add',array('login'=>htmlspecialchars($sUser))),
|
||||
'sUserId'=>$oUser->getId(),
|
||||
'sUserLogin'=>htmlspecialchars($sUser),
|
||||
'sUserWebPath'=>$oUser->getUserWebPath(),
|
||||
'sUserAvatar48'=>$oUser->getProfileAvatarPath(48)
|
||||
'sUserAvatar48'=>$oUser->getProfileAvatarPath(48),
|
||||
'sUserHtml'=>$oViewer->Fetch("user_list_small_item.tpl")
|
||||
);
|
||||
} else {
|
||||
$aResult[]=array(
|
||||
|
@ -812,7 +816,7 @@ class ActionTalk extends Action {
|
|||
* Устанавливаем формат Ajax ответа
|
||||
*/
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
$idTarget=getRequestStr('idTarget',null,'post');
|
||||
$iUserId=getRequestStr('iUserId',null,'post');
|
||||
/**
|
||||
* Если пользователь не авторизирован, возвращаем ошибку
|
||||
*/
|
||||
|
@ -826,9 +830,9 @@ class ActionTalk extends Action {
|
|||
/**
|
||||
* Если пользователь не существуем, возращаем ошибку
|
||||
*/
|
||||
if (!$oUserTarget=$this->User_GetUserById($idTarget)) {
|
||||
if (!$oUserTarget=$this->User_GetUserById($iUserId)) {
|
||||
$this->Message_AddErrorSingle(
|
||||
$this->Lang_Get('user_not_found_by_id',array('id'=>htmlspecialchars($idTarget))),
|
||||
$this->Lang_Get('user_not_found_by_id',array('id'=>htmlspecialchars($iUserId))),
|
||||
$this->Lang_Get('error')
|
||||
);
|
||||
return;
|
||||
|
@ -853,12 +857,12 @@ class ActionTalk extends Action {
|
|||
/**
|
||||
* Производим удаление пользователя из блекслиста
|
||||
*/
|
||||
if(!$this->Talk_DeleteUserFromBlacklist($idTarget,$this->oUserCurrent->getId())) {
|
||||
if(!$this->Talk_DeleteUserFromBlacklist($iUserId,$this->oUserCurrent->getId())) {
|
||||
return $this->EventErrorDebug();
|
||||
}
|
||||
$this->Message_AddNoticeSingle(
|
||||
$this->Lang_Get(
|
||||
'talk_blacklist_delete_ok',
|
||||
'common.success.remove',
|
||||
array('login'=>$oUserTarget->getLogin())
|
||||
),
|
||||
$this->Lang_Get('attention')
|
||||
|
@ -873,8 +877,8 @@ class ActionTalk extends Action {
|
|||
* Устанавливаем формат Ajax ответа
|
||||
*/
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
$idTarget=getRequestStr('idTarget',null,'post');
|
||||
$idTalk=getRequestStr('idTalk',null,'post');
|
||||
$iUserId=getRequestStr('iUserId',null,'post');
|
||||
$iTalkId=getRequestStr('iTargetId',null,'post');
|
||||
/**
|
||||
* Если пользователь не авторизирован, возвращаем ошибку
|
||||
*/
|
||||
|
@ -888,9 +892,9 @@ class ActionTalk extends Action {
|
|||
/**
|
||||
* Если удаляемый участник не существует в базе данных, возвращаем ошибку
|
||||
*/
|
||||
if (!$oUserTarget=$this->User_GetUserById($idTarget)) {
|
||||
if (!$oUserTarget=$this->User_GetUserById($iUserId)) {
|
||||
$this->Message_AddErrorSingle(
|
||||
$this->Lang_Get('user_not_found_by_id',array('id'=>htmlspecialchars($idTarget))),
|
||||
$this->Lang_Get('user_not_found_by_id',array('id'=>htmlspecialchars($iUserId))),
|
||||
$this->Lang_Get('error')
|
||||
);
|
||||
return;
|
||||
|
@ -898,7 +902,7 @@ class ActionTalk extends Action {
|
|||
/**
|
||||
* Если разговор не найден, или пользователь не является его автором (либо админом), возвращаем ошибку
|
||||
*/
|
||||
if((!$oTalk=$this->Talk_GetTalkById($idTalk))
|
||||
if((!$oTalk=$this->Talk_GetTalkById($iTalkId))
|
||||
|| ( ($oTalk->getUserId()!=$this->oUserCurrent->getId()) && !$this->oUserCurrent->isAdministrator() ) ) {
|
||||
$this->Message_AddErrorSingle(
|
||||
$this->Lang_Get('talk_not_found'),
|
||||
|
@ -913,8 +917,8 @@ class ActionTalk extends Action {
|
|||
/**
|
||||
* Если пользователь не является участником разговора или удалил себя самостоятельно возвращаем ошибку
|
||||
*/
|
||||
if(!isset($aTalkUsers[$idTarget])
|
||||
|| $aTalkUsers[$idTarget]->getUserActive()==ModuleTalk::TALK_USER_DELETE_BY_SELF) {
|
||||
if(!isset($aTalkUsers[$iUserId])
|
||||
|| $aTalkUsers[$iUserId]->getUserActive()==ModuleTalk::TALK_USER_DELETE_BY_SELF) {
|
||||
$this->Message_AddErrorSingle(
|
||||
$this->Lang_Get(
|
||||
'talk_speaker_user_not_found',
|
||||
|
@ -927,7 +931,7 @@ class ActionTalk extends Action {
|
|||
/**
|
||||
* Удаляем пользователя из разговора, если удаление прошло неудачно - возвращаем системную ошибку
|
||||
*/
|
||||
if(!$this->Talk_DeleteTalkUserByArray($idTalk,$idTarget,ModuleTalk::TALK_USER_DELETE_BY_AUTHOR)) {
|
||||
if(!$this->Talk_DeleteTalkUserByArray($iTalkId,$iUserId,ModuleTalk::TALK_USER_DELETE_BY_AUTHOR)) {
|
||||
return $this->EventErrorDebug();
|
||||
}
|
||||
$this->Message_AddNoticeSingle(
|
||||
|
@ -947,8 +951,8 @@ class ActionTalk extends Action {
|
|||
* Устанавливаем формат Ajax ответа
|
||||
*/
|
||||
$this->Viewer_SetResponseAjax('json');
|
||||
$sUsers=getRequestStr('users',null,'post');
|
||||
$idTalk=getRequestStr('idTalk',null,'post');
|
||||
$sUsers=getRequestStr('sUserList',null,'post');
|
||||
$idTalk=getRequestStr('iTargetId',null,'post');
|
||||
/**
|
||||
* Если пользователь не авторизирован, возвращаем ошибку
|
||||
*/
|
||||
|
@ -1027,6 +1031,10 @@ class ActionTalk extends Action {
|
|||
)
|
||||
) {
|
||||
$this->Notify_SendTalkNew($oUser,$this->oUserCurrent,$oTalk);
|
||||
|
||||
$oViewer = $this->Viewer_GetLocalViewer();
|
||||
$oViewer->Assign('oUser', $oUser);
|
||||
|
||||
$aResult[]=array(
|
||||
'bStateError'=>false,
|
||||
'sMsgTitle'=>$this->Lang_Get('attention'),
|
||||
|
@ -1035,7 +1043,8 @@ class ActionTalk extends Action {
|
|||
'sUserLogin'=>$oUser->getLogin(),
|
||||
'sUserLink'=>$oUser->getUserWebPath(),
|
||||
'sUserWebPath'=>$oUser->getUserWebPath(),
|
||||
'sUserAvatar48'=>$oUser->getProfileAvatarPath(48)
|
||||
'sUserAvatar48'=>$oUser->getProfileAvatarPath(48),
|
||||
'sUserHtml'=>$oViewer->Fetch("user_list_small_item.tpl")
|
||||
);
|
||||
$bState=true;
|
||||
} else {
|
||||
|
@ -1112,7 +1121,7 @@ class ActionTalk extends Action {
|
|||
$aResult[]=array(
|
||||
'bStateError'=>true,
|
||||
'sMsgTitle'=>$this->Lang_Get('error'),
|
||||
'sMsg'=>$this->Lang_Get('talk_user_in_blacklist',array('login'=>htmlspecialchars($sUser)))
|
||||
'sMsg'=>$this->Lang_Get('messages.blacklist.alerts.blocked',array('login'=>htmlspecialchars($sUser)))
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -394,7 +394,6 @@ $config['block']['userfeedUsers'] = array(
|
|||
'action' => array('feed'),
|
||||
'blocks' => array(
|
||||
'right' => array(
|
||||
'userfeedFriends'=> array(),
|
||||
'userfeedUsers'=> array()
|
||||
)
|
||||
)
|
||||
|
@ -517,6 +516,7 @@ $config['head']['default']['js'] = array(
|
|||
"___path.application.web___/frontend/common/js/media.js",
|
||||
"___path.application.web___/frontend/common/js/tags.js",
|
||||
"___path.application.web___/frontend/common/js/content.js",
|
||||
"___path.application.web___/frontend/common/js/user_list_add.js",
|
||||
"___path.application.web___/frontend/common/js/init.js",
|
||||
|
||||
"http://yandex.st/share/share.js" => array('merge'=>false),
|
||||
|
|
|
@ -26,8 +26,6 @@ ls.blog = (function ($) {
|
|||
info: aRouter['blog'] + 'ajaxbloginfo/',
|
||||
search: aRouter['blogs'] + 'ajax-search/',
|
||||
invite: {
|
||||
add: aRouter['blog'] + 'ajaxaddbloginvite/',
|
||||
remove: aRouter['blog'] + 'ajaxremovebloginvite/',
|
||||
repeat: aRouter['blog'] + 'ajaxrebloginvite/',
|
||||
}
|
||||
},
|
||||
|
@ -40,15 +38,6 @@ ls.blog = (function ($) {
|
|||
info: '.js-blog-info',
|
||||
blog_add_type_note: '#blog_type_note',
|
||||
invite: {
|
||||
form: {
|
||||
self: '.js-blog-invite-form',
|
||||
users: '.js-blog-invite-form-users',
|
||||
submit: '.js-blog-invite-form-submit',
|
||||
},
|
||||
container: '.js-blog-invite-container',
|
||||
user_list: '.js-blog-invite-users',
|
||||
user: '.js-blog-invite-user',
|
||||
user_remove: '.js-blog-invite-user-remove',
|
||||
user_repeat: '.js-blog-invite-user-repeat',
|
||||
},
|
||||
nav: {
|
||||
|
@ -56,22 +45,6 @@ ls.blog = (function ($) {
|
|||
blogs: '.js-blog-nav-blogs',
|
||||
submit: '.js-blog-nav-submit',
|
||||
}
|
||||
},
|
||||
|
||||
// HTML
|
||||
html: {
|
||||
invite_item: function(iBlogId, aUser) {
|
||||
return '<li class="user-list-small-item js-blog-invite-user" data-blog-id="' + iBlogId + '" data-user-id="' + aUser.iUserId + '">' +
|
||||
'<div class="user-item">' +
|
||||
'<a href="' + aUser.sUserWebPath + '" class="user-item-avatar-link"><img src="' + aUser.sUserAvatar48 + '" class="user-item-avatar" width="24" /></a> ' +
|
||||
'<a href="' + aUser.sUserWebPath + '" class="user-item-name">' + aUser.sUserLogin + '</a> ' +
|
||||
'</div>' +
|
||||
'<div class="user-list-small-item-actions">' +
|
||||
'<a href="#" class="icon-repeat js-blog-invite-user-repeat" title=""></a> ' +
|
||||
'<a href="#" class="icon-remove js-blog-invite-user-remove" title=""></a>' +
|
||||
'</div>' +
|
||||
'</li>';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -86,16 +59,6 @@ ls.blog = (function ($) {
|
|||
this.options = $.extend({}, _defaults, options);
|
||||
|
||||
this.elements = {
|
||||
invite: {
|
||||
form: {
|
||||
self: $(this.options.selectors.invite.form.self),
|
||||
users: $(this.options.selectors.invite.form.users),
|
||||
submit: $(this.options.selectors.invite.form.submit),
|
||||
},
|
||||
container: $(this.options.selectors.invite.container),
|
||||
user_list: $(this.options.selectors.invite.user_list),
|
||||
user: $(this.options.selectors.invite.user),
|
||||
},
|
||||
nav: {
|
||||
categories: $(this.options.selectors.nav.categories),
|
||||
blogs: $(this.options.selectors.nav.blogs),
|
||||
|
@ -121,25 +84,14 @@ ls.blog = (function ($) {
|
|||
* Инвайты
|
||||
*/
|
||||
|
||||
// Добавить инвайт
|
||||
this.elements.invite.form.self.on('submit', function (e) {
|
||||
_this.invite.add($(this).data('blog-id'), _this.elements.invite.form.users.val());
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Удалить инвайт
|
||||
$(document).on('click', this.options.selectors.invite.user_remove, function (e) {
|
||||
var oElement = $(this).closest(_this.options.selectors.invite.user);
|
||||
|
||||
_this.invite.remove(oElement.data('user-id'), oElement.data('blog-id'));
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Повторно отправить инвайт
|
||||
$(document).on('click', this.options.selectors.invite.user_repeat, function (e) {
|
||||
var oElement = $(this).closest(_this.options.selectors.invite.user);
|
||||
var oButton = $(this),
|
||||
oContainer = oButton.closest(ls.user_list_add.options.selectors.container),
|
||||
oUserList = oContainer.find(ls.user_list_add.options.selectors.user_list);
|
||||
|
||||
_this.invite.repeat(oButton.data('user-id'), oContainer.data('target-id'));
|
||||
|
||||
_this.invite.repeat(oElement.data('user-id'), oElement.data('blog-id'));
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
|
@ -292,77 +244,6 @@ ls.blog = (function ($) {
|
|||
* Приглашения
|
||||
*/
|
||||
this.invite = function(_this) {
|
||||
/**
|
||||
* Отправляет приглашение вступить в блог
|
||||
*/
|
||||
this.add = function(iBlogId, sUsers) {
|
||||
if( ! sUsers ) return false;
|
||||
|
||||
var sUrl = _this.options.routers.invite.add,
|
||||
oParams = { users: sUsers, idBlog: iBlogId };
|
||||
|
||||
_this.elements.invite.form.submit.prop('disabled', true).addClass(ls.options.classes.states.loading);
|
||||
_this.elements.invite.form.users.autocomplete('disable');
|
||||
|
||||
ls.hook.marker('addInviteBefore');
|
||||
|
||||
ls.ajax.load(sUrl, oParams, function(result) {
|
||||
_this.elements.invite.form.submit.prop('disabled', false).removeClass(ls.options.classes.states.loading);
|
||||
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(null, result.sMsg);
|
||||
} else {
|
||||
_this.elements.invite.form.users.val('');
|
||||
|
||||
$($.map(result.aUsers, function(value, index) {
|
||||
if (value.bStateError) {
|
||||
ls.msg.error(null, value.sMsg);
|
||||
} else {
|
||||
ls.msg.notice(null, value.sMsg);
|
||||
_this.elements.invite.container.show();
|
||||
|
||||
var oItem = _this.options.html.invite_item(iBlogId, value);
|
||||
|
||||
ls.hook.run('ls_blog_add_invite_user_after', [iBlogId, value], oItem);
|
||||
|
||||
return oItem;
|
||||
}
|
||||
}).join('')).appendTo(_this.elements.invite.user_list);
|
||||
|
||||
ls.hook.run('ls_blog_add_invite_after', [iBlogId, sUsers, result]);
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Удаляет приглашение в блог
|
||||
*/
|
||||
this.remove = function(iUserId, iBlogId) {
|
||||
var sUrl = _this.options.routers.invite.remove,
|
||||
oParams = { idUser: iUserId, idBlog: iBlogId };
|
||||
|
||||
ls.hook.marker('removeInviteBefore');
|
||||
|
||||
ls.ajax.load(sUrl, oParams, function(result) {
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(null, result.sMsg);
|
||||
} else {
|
||||
ls.msg.notice(null, result.sMsg);
|
||||
|
||||
$(this.options.selectors.invite.user + '[data-user-id=' + iUserId + ']').fadeOut('slow', function() {
|
||||
$(this).remove();
|
||||
if ($(_this.options.selectors.invite.user).length === 0) _this.elements.invite.container.hide();
|
||||
|
||||
ls.hook.run('ls_blog_remove_invite_after', [iUserId, iBlogId, result]);
|
||||
});
|
||||
}
|
||||
}.bind(_this));
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Повторно отправляет приглашение
|
||||
*/
|
||||
|
|
|
@ -10,128 +10,34 @@
|
|||
|
||||
var ls = ls || {};
|
||||
|
||||
ls.stream =( function ($) {
|
||||
ls.stream = (function ($) {
|
||||
"use strict";
|
||||
|
||||
this.isBusy = false;
|
||||
this.sDateLast = null;
|
||||
|
||||
this.options = {
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
var defaults = {
|
||||
selectors: {
|
||||
userList: 'js-activity-block-users',
|
||||
getMoreButton: 'activity-get-more',
|
||||
userListId: 'activity-block-users',
|
||||
inputId: 'activity-block-users-input',
|
||||
noticeId: 'activity-block-users-notice',
|
||||
userListItemId: 'activity-block-users-item-'
|
||||
},
|
||||
elements: {
|
||||
userItem: function (element) {
|
||||
return $('<li id="' + ls.stream.options.selectors.userListItemId + element.uid + '">' +
|
||||
'<input type="checkbox" ' +
|
||||
'class="input-checkbox" ' +
|
||||
'data-user-id="' + element.uid + '" ' +
|
||||
'checked="checked" />' +
|
||||
'<a href="' + element.user_web_path + '">' + element.user_login + '</a>' +
|
||||
'</li>');
|
||||
}
|
||||
getMoreButton: '#activity-get-more',
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Init
|
||||
* Инициализация
|
||||
*
|
||||
* @param {Object} options Опции
|
||||
*/
|
||||
this.init = function () {
|
||||
this.init = function(options) {
|
||||
this.options = $.extend({}, defaults, options);
|
||||
|
||||
var self = this;
|
||||
|
||||
$('.' + this.options.selectors.userList).on('change', 'input[type=checkbox]', function () {
|
||||
var userId = $(this).data('user-id');
|
||||
|
||||
$(this).prop('checked') ? self.subscribe(userId) : self.unsubscribe(userId);
|
||||
});
|
||||
|
||||
$('#' + this.options.selectors.getMoreButton).on('click', function () {
|
||||
$(this.options.selectors.getMoreButton).on('click', function () {
|
||||
self.getMore(this);
|
||||
});
|
||||
|
||||
$('#' + this.options.selectors.inputId).keydown(function (event) {
|
||||
event.which == 13 && ls.stream.appendUser();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Подписаться на пользователя
|
||||
* @param {Number} iUserId ID пользователя
|
||||
*/
|
||||
this.subscribe = function (iUserId) {
|
||||
var self = this,
|
||||
url = aRouter['stream'] + 'subscribe/',
|
||||
params = { 'id': iUserId };
|
||||
|
||||
ls.hook.marker('subscribeBefore');
|
||||
|
||||
ls.ajax.load(url, params, function(data) {
|
||||
if (data.bStateError) {
|
||||
ls.msg.error(data.sMsgTitle,data.sMsg);
|
||||
} else {
|
||||
ls.msg.notice(data.sMsgTitle,data.sMsg);
|
||||
ls.hook.run('ls_stream_subscribe_after',[params,data]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Отписаться от пользователя
|
||||
* @param {Number} iUserId ID пользователя
|
||||
*/
|
||||
this.unsubscribe = function (iUserId) {
|
||||
var self = this,
|
||||
url = aRouter['stream'] + 'unsubscribe/',
|
||||
params = { 'id': iUserId };
|
||||
|
||||
ls.hook.marker('unsubscribeBefore');
|
||||
|
||||
ls.ajax.load(url, params, function(data) {
|
||||
if (!data.bStateError) {
|
||||
ls.msg.notice(data.sMsgTitle,data.sMsg);
|
||||
ls.hook.run('ls_stream_unsubscribe_after',[params,data]);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Подписаться на пользователя
|
||||
*/
|
||||
this.appendUser = function() {
|
||||
var self = this,
|
||||
sLogin = $('#' + self.options.selectors.inputId).val();
|
||||
|
||||
if ( ! sLogin ) return;
|
||||
|
||||
ls.hook.marker('appendUserBefore');
|
||||
|
||||
ls.ajax.load(aRouter['stream'] + 'subscribeByLogin/', { 'login' : sLogin }, function(data) {
|
||||
if ( ! data.bStateError ) {
|
||||
var checkbox = $('.' + self.options.selectors.userList).find('input[data-user-id=' + data.uid + ']');
|
||||
|
||||
$('#' + self.options.selectors.noticeId).remove();
|
||||
|
||||
if (checkbox.length) {
|
||||
if (checkbox.prop("checked")) {
|
||||
ls.msg.error(ls.lang.get('error'), ls.lang.get('stream_subscribes_already_subscribed'));
|
||||
} else {
|
||||
checkbox.prop("checked", true);
|
||||
ls.msg.notice(data.sMsgTitle,data.sMsg);
|
||||
}
|
||||
} else {
|
||||
$('#' + self.options.selectors.inputId).autocomplete('close').val('');
|
||||
$('#' + self.options.selectors.userListId).show().append(self.options.elements.userItem(data));
|
||||
ls.msg.notice(data.sMsgTitle,data.sMsg);
|
||||
}
|
||||
|
||||
ls.hook.run('ls_stream_append_user_after',[checkbox.length,data]);
|
||||
} else {
|
||||
ls.msg.error(data.sMsgTitle, data.sMsg);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.switchEventType = function (iType) {
|
||||
|
|
|
@ -11,177 +11,22 @@
|
|||
var ls = ls || {};
|
||||
|
||||
ls.talk = (function ($) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Init
|
||||
* Дефолтные опции
|
||||
*/
|
||||
this.init = function () {
|
||||
// Добавляем или удаляем друга из списка получателей
|
||||
$('#friends input:checkbox').change(function(){
|
||||
ls.talk.toggleRecipient($('#'+$(this).attr('id')+'_label').text(), $(this).prop('checked'));
|
||||
});
|
||||
var defaults = {
|
||||
|
||||
// Добавляем всех друзей в список получателей
|
||||
$('#friend_check_all').click(function(){
|
||||
$('#friends input:checkbox').each(function(index, item){
|
||||
ls.talk.toggleRecipient($('#'+$(item).attr('id')+'_label').text(), true);
|
||||
$(item).attr('checked', true);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// Удаляем всех друзей из списка получателей
|
||||
$('#friend_uncheck_all').click(function(){
|
||||
$('#friends input:checkbox').each(function(index, item){
|
||||
ls.talk.toggleRecipient($('#'+$(item).attr('id')+'_label').text(), false);
|
||||
$(item).attr('checked', false);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// Удаляем пользователя из черного списка
|
||||
$("#black_list_block").on("click", "a.delete", function(){
|
||||
ls.talk.removeFromBlackList(this);
|
||||
return false;
|
||||
});
|
||||
|
||||
// Удаляем пользователя из переписки
|
||||
$("#speaker_list_block").on("click", "a.delete", function(){
|
||||
ls.talk.removeFromTalk(this, $('#talk_id').val());
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Добавляет пользователя к переписке
|
||||
*/
|
||||
this.addToTalk = function(idTalk){
|
||||
var sUsers = $('#talk_speaker_add').val();
|
||||
if(!sUsers) return false;
|
||||
$('#talk_speaker_add').val('');
|
||||
|
||||
var url = aRouter['talk']+'ajaxaddtalkuser/';
|
||||
var params = {users: sUsers, idTalk: idTalk};
|
||||
|
||||
ls.hook.marker('addToTalkBefore');
|
||||
ls.ajax.load(url, params, function(result) {
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(null, result.sMsg);
|
||||
} else {
|
||||
$.each(result.aUsers, function(index, item) {
|
||||
if(item.bStateError){
|
||||
ls.msg.notice(null, item.sMsg);
|
||||
} else {
|
||||
var list = $('#speaker_list');
|
||||
if(list.length == 0) {
|
||||
list = $('<ul class="list" id="speaker_list"></ul>');
|
||||
$('#speaker_list_block').append(list);
|
||||
}
|
||||
var listItem = $('<li id="speaker_item_'+item.sUserId+'_area"><a href="'+item.sUserLink+'" class="user">'+item.sUserLogin+'</a> - <a href="#" id="speaker_item_'+item.sUserId+'" class="delete">'+ls.lang.get('delete')+'</a></li>')
|
||||
list.append(listItem);
|
||||
ls.hook.run('ls_talk_add_to_talk_item_after',[idTalk,item],listItem);
|
||||
}
|
||||
});
|
||||
|
||||
ls.hook.run('ls_talk_add_to_talk_after',[idTalk,result]);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Удаляет пользователя из переписки
|
||||
*/
|
||||
this.removeFromTalk = function(link, idTalk) {
|
||||
link = $(link);
|
||||
|
||||
$('#'+link.attr('id')+'_area').fadeOut(500,function(){
|
||||
$(this).remove();
|
||||
});
|
||||
var idTarget = link.attr('id').replace('speaker_item_','');
|
||||
|
||||
var url = aRouter['talk']+'ajaxdeletetalkuser/';
|
||||
var params = {idTarget: idTarget, idTalk: idTalk};
|
||||
|
||||
ls.hook.marker('removeFromTalkBefore');
|
||||
ls.ajax.load(url, params, function(result) {
|
||||
if (!result) {
|
||||
ls.msg.error('Error','Please try again later');
|
||||
link.parent('li').show();
|
||||
}
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(null, result.sMsg);
|
||||
link.parent('li').show();
|
||||
}
|
||||
ls.hook.run('ls_talk_remove_from_talk_after',[idTalk,idTarget],link);
|
||||
});
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Добавляет пользователя в черный список
|
||||
*/
|
||||
this.addToBlackList = function() {
|
||||
var sUsers = $('#talk_blacklist_add').val();
|
||||
if(!sUsers) return false;
|
||||
$('#talk_blacklist_add').val('');
|
||||
|
||||
var url = aRouter['talk']+'ajaxaddtoblacklist/';
|
||||
var params = {users: sUsers};
|
||||
|
||||
ls.hook.marker('addToBlackListBefore');
|
||||
ls.ajax.load(url, params, function(result) {
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(null, result.sMsg);
|
||||
} else {
|
||||
$.each(result.aUsers, function(index, item) {
|
||||
if(item.bStateError){
|
||||
ls.msg.notice(null, item.sMsg);
|
||||
} else {
|
||||
var list = $('#black_list');
|
||||
if(list.length == 0) {
|
||||
list = $('<ul class="list" id="black_list"></ul>');
|
||||
$('#black_list_block').append(list);
|
||||
}
|
||||
var listItem = $('<li id="blacklist_item_'+item.sUserId+'_area"><a href="#" class="user">'+item.sUserLogin+'</a> - <a href="#" id="blacklist_item_'+item.sUserId+'" class="delete">'+ls.lang.get('delete')+'</a></li>');
|
||||
$('#black_list').append(listItem);
|
||||
ls.hook.run('ls_talk_add_to_black_list_item_after',[item],listItem);
|
||||
}
|
||||
});
|
||||
ls.hook.run('ls_talk_add_to_black_list_after',[result]);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Удаляет пользователя из черного списка
|
||||
*/
|
||||
this.removeFromBlackList = function(link) {
|
||||
link = $(link);
|
||||
|
||||
$('#'+link.attr('id')+'_area').fadeOut(500,function(){
|
||||
$(this).remove();
|
||||
});
|
||||
var idTarget = link.attr('id').replace('blacklist_item_','');
|
||||
|
||||
var url = aRouter['talk']+'ajaxdeletefromblacklist/';
|
||||
var params = {idTarget: idTarget};
|
||||
|
||||
ls.hook.marker('removeFromBlackListBefore');
|
||||
ls.ajax.load(url, params, function(result) {
|
||||
if (!result) {
|
||||
ls.msg.error('Error','Please try again later');
|
||||
link.parent('li').show();
|
||||
}
|
||||
if (result.bStateError) {
|
||||
ls.msg.error(null, result.sMsg);
|
||||
link.parent('li').show();
|
||||
}
|
||||
ls.hook.run('ls_talk_remove_from_black_list_after',[idTarget],link);
|
||||
});
|
||||
return false;
|
||||
* Инициализация
|
||||
*
|
||||
* @param {Object} options Опции
|
||||
*/
|
||||
this.init = function(options) {
|
||||
this.options = $.extend({}, defaults, options);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
205
application/frontend/common/js/user_list_add.js
Normal file
205
application/frontend/common/js/user_list_add.js
Normal file
|
@ -0,0 +1,205 @@
|
|||
/**
|
||||
* Пополняемый список пользователей
|
||||
*
|
||||
* @module ls/user_list_add
|
||||
*
|
||||
* @license GNU General Public License, version 2
|
||||
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
|
||||
* @author Denis Shakhov <denis.shakhov@gmail.com>
|
||||
*/
|
||||
|
||||
var ls = ls || {};
|
||||
|
||||
ls.user_list_add = (function ($) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
var defaults = {
|
||||
// Селекторы
|
||||
selectors: {
|
||||
container: '.js-user-list-add',
|
||||
user_list: '.js-user-list-add-users',
|
||||
user_item: '.js-user-list-small-item',
|
||||
user_list_empty: '.js-user-list-small-empty',
|
||||
form: {
|
||||
form: '.js-user-list-add-form',
|
||||
users: '.js-user-list-add-form-users',
|
||||
submit: '.js-user-list-add-form-submit'
|
||||
},
|
||||
actions: {
|
||||
remove: '.js-user-list-add-user-remove'
|
||||
}
|
||||
},
|
||||
|
||||
// Типы списков
|
||||
type: {
|
||||
// Приглашение пользователей в блог
|
||||
blog_invite: {
|
||||
url: {
|
||||
add: aRouter['blog'] + 'ajaxaddbloginvite/',
|
||||
remove: aRouter['blog'] + 'ajaxremovebloginvite/'
|
||||
}
|
||||
},
|
||||
// Добавление участников личного сообщения
|
||||
message: {
|
||||
url: {
|
||||
add: aRouter['talk'] + 'ajaxaddtalkuser/',
|
||||
remove: aRouter['talk'] + 'ajaxdeletetalkuser/'
|
||||
}
|
||||
},
|
||||
// Черный список
|
||||
blacklist: {
|
||||
url: {
|
||||
add: aRouter['talk'] + 'ajaxaddtoblacklist/',
|
||||
remove: aRouter['talk'] + 'ajaxdeletefromblacklist/'
|
||||
}
|
||||
},
|
||||
// Добавление пользователей в свою активность
|
||||
activity: {
|
||||
url: {
|
||||
add: aRouter['stream'] + 'ajaxadduser/',
|
||||
remove: aRouter['stream'] + 'ajaxremoveuser/'
|
||||
}
|
||||
},
|
||||
// Добавление пользователей в свою ленту
|
||||
userfeed: {
|
||||
url: {
|
||||
add: aRouter['feed'] + 'ajaxadduser/',
|
||||
remove: aRouter['feed'] + 'ajaxremoveuser/'
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Инициализация
|
||||
*
|
||||
* @param {Object} options Опции
|
||||
*/
|
||||
this.init = function(options) {
|
||||
var _this = this;
|
||||
|
||||
this.options = $.extend({}, defaults, options);
|
||||
|
||||
this.elements = {
|
||||
form: $(this.options.selectors.form.form),
|
||||
actions: {
|
||||
remove: $(this.options.selectors.actions.remove)
|
||||
}
|
||||
}
|
||||
|
||||
// Добавление
|
||||
this.elements.form.on('submit', function(e) {
|
||||
var oForm = $(this),
|
||||
oContainer = oForm.closest(_this.options.selectors.container),
|
||||
oFormUsers = oForm.find(_this.options.selectors.form.users),
|
||||
oButton = oForm.find(_this.options.selectors.form.submit),
|
||||
oUserList = oContainer.find(_this.options.selectors.user_list),
|
||||
sUserList = oFormUsers.val(),
|
||||
oEmptyAlert = oContainer.find(_this.options.selectors.user_list_empty);
|
||||
|
||||
if ( ! sUserList ) return false;
|
||||
|
||||
// Блокируем форму
|
||||
oButton.prop('disabled', true).addClass(ls.options.classes.states.loading);
|
||||
oFormUsers.prop('disabled', true);
|
||||
|
||||
_this.add(oContainer.data('type'), oContainer.data('target-id'), sUserList, {
|
||||
add_success: function (oResponse) {
|
||||
oFormUsers.val('');
|
||||
},
|
||||
add_user_success: function (oUser) {
|
||||
oUserList.show().prepend(oUser.sUserHtml);
|
||||
oEmptyAlert.hide();
|
||||
},
|
||||
add_after: function (oResponse) {
|
||||
// Разблокировываем форму
|
||||
oButton.prop('disabled', false).removeClass(ls.options.classes.states.loading);
|
||||
oFormUsers.prop('disabled', false).focus();
|
||||
}
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Удаление
|
||||
$(document).on('click', this.options.selectors.actions.remove, function(e) {
|
||||
var oButton = $(this),
|
||||
oContainer = oButton.closest(_this.options.selectors.container),
|
||||
oUserList = oContainer.find(_this.options.selectors.user_list),
|
||||
oEmptyAlert = oContainer.find(_this.options.selectors.user_list_empty);
|
||||
|
||||
_this.remove(oContainer.data('type'), oContainer.data('target-id'), oButton.data('user-id'), function (oResponse, iUserId) {
|
||||
oContainer.find(this.options.selectors.user_item + '[data-user-id=' + iUserId + ']').fadeOut(300, function () {
|
||||
$(this).remove();
|
||||
|
||||
// Скрываем список если пользователей в нем нет
|
||||
if ( ! oUserList.find(_this.options.selectors.user_item).length ) {
|
||||
oUserList.hide();
|
||||
oEmptyAlert.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Добавление пользователя
|
||||
*/
|
||||
this.add = function(sType, iTargetId, sUserList, aCallbacks) {
|
||||
if ( ! sUserList ) return false;
|
||||
|
||||
var sUrl = this.options.type[sType].url.add,
|
||||
oParams = {
|
||||
iTargetId: iTargetId,
|
||||
sUserList: sUserList
|
||||
};
|
||||
|
||||
ls.ajax.load(sUrl, oParams, function(oResponse) {
|
||||
if (oResponse.bStateError) {
|
||||
ls.msg.error(null, oResponse.sMsg);
|
||||
} else {
|
||||
$.each(oResponse.aUsers, function (iIndex, oUser) {
|
||||
if (oUser.bStateError) {
|
||||
ls.msg.error(null, oUser.sMsg);
|
||||
} else {
|
||||
ls.msg.notice(null, ls.lang.get('common.success.add'));
|
||||
|
||||
if (typeof aCallbacks.add_user_success === 'function') aCallbacks.add_user_success.call(this, oUser);
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof aCallbacks.add_success === 'function') aCallbacks.add_success.call(this, oResponse);
|
||||
}
|
||||
|
||||
if (typeof aCallbacks.add_after === 'function') aCallbacks.add_after.call(this, oResponse);
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Удаление пользователя
|
||||
*/
|
||||
this.remove = function(sType, iTargetId, iUserId, fCallbackSuccess) {
|
||||
var sUrl = this.options.type[sType].url.remove,
|
||||
oParams = {
|
||||
iTargetId: iTargetId,
|
||||
iUserId: iUserId
|
||||
};
|
||||
|
||||
ls.ajax.load(sUrl, oParams, function(oResponse) {
|
||||
if (oResponse.bStateError) {
|
||||
ls.msg.error(null, oResponse.sMsg);
|
||||
} else {
|
||||
ls.msg.notice(null, ls.lang.get('common.success.remove'));
|
||||
|
||||
if (typeof fCallbackSuccess === 'function') fCallbackSuccess.call(this, oResponse, iUserId);
|
||||
}
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
return this;
|
||||
}).call(ls.user_list_add || {}, jQuery);
|
|
@ -11,38 +11,24 @@
|
|||
var ls = ls || {};
|
||||
|
||||
ls.userfeed = (function ($) {
|
||||
"use strict";
|
||||
|
||||
this.isBusy = false;
|
||||
|
||||
this.options = {
|
||||
selectors: {
|
||||
userList: 'js-userfeed-block-users',
|
||||
userListId: 'userfeed-block-users',
|
||||
inputId: 'userfeed-block-users-input',
|
||||
noticeId: 'userfeed-block-users-notice',
|
||||
userListItemId: 'userfeed-block-users-item-'
|
||||
},
|
||||
elements: {
|
||||
userItem: function (element) {
|
||||
return ls.stream.options.elements.userItem(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Дефолтные опции
|
||||
*/
|
||||
var defaults = {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Init
|
||||
* Инициализация
|
||||
*
|
||||
* @param {Object} options Опции
|
||||
*/
|
||||
this.init = function () {
|
||||
var self = this;
|
||||
|
||||
$('.' + this.options.selectors.userList).on('change', 'input[type=checkbox]', function () {
|
||||
var userId = $(this).data('user-id');
|
||||
|
||||
$(this).prop('checked') ? self.subscribe('users', userId) : self.unsubscribe('users', userId);
|
||||
});
|
||||
|
||||
$('#' + this.options.selectors.inputId).keydown(function (event) {
|
||||
event.which == 13 && ls.userfeed.appendUser();
|
||||
});
|
||||
this.init = function(options) {
|
||||
this.options = $.extend({}, defaults, options);
|
||||
};
|
||||
|
||||
this.subscribe = function (sType, iId) {
|
||||
|
@ -71,39 +57,6 @@ ls.userfeed = (function ($) {
|
|||
});
|
||||
}
|
||||
|
||||
this.appendUser = function() {
|
||||
var self = this,
|
||||
sLogin = $('#' + self.options.selectors.inputId).val();
|
||||
|
||||
if ( ! sLogin ) return;
|
||||
|
||||
ls.hook.marker('appendUserBefore');
|
||||
|
||||
ls.ajax.load(aRouter['feed']+'subscribeByLogin/', {'login':sLogin}, function(data) {
|
||||
if (data.bStateError) {
|
||||
ls.msg.error(data.sMsgTitle,data.sMsg);
|
||||
} else {
|
||||
var checkbox = $('.' + self.options.selectors.userList).find('input[data-user-id=' + data.uid + ']');
|
||||
|
||||
$('#' + self.options.selectors.noticeId).remove();
|
||||
|
||||
if (checkbox.length) {
|
||||
if (checkbox.prop('checked')) {
|
||||
ls.msg.error(data.lang_error_title,data.lang_error_msg);
|
||||
return;
|
||||
} else {
|
||||
checkbox.prop('checked', true);
|
||||
ls.msg.notice(data.sMsgTitle,data.sMsg);
|
||||
}
|
||||
} else {
|
||||
$('#' + self.options.selectors.inputId).autocomplete('close').val('');
|
||||
$('#' + self.options.selectors.userListId).append(self.options.elements.userItem(data));
|
||||
ls.msg.notice(data.sMsgTitle,data.sMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.getMore = function () {
|
||||
if (this.isBusy) {
|
||||
return;
|
||||
|
|
|
@ -129,15 +129,4 @@
|
|||
.block-type-profile-actions ul li { margin-bottom: 0; }
|
||||
.block-type-profile-actions ul li a { display: block; padding: 10px 15px; }
|
||||
.block-type-profile-actions ul li a:hover { background: #fafafa; }
|
||||
.block-type-profile-actions ul li a.followed { color: #f00; }
|
||||
|
||||
|
||||
/**
|
||||
* Настройки персональной активности
|
||||
*
|
||||
* @modifier activity
|
||||
* @template blocks/block.activity*.tpl
|
||||
*/
|
||||
.block-type-activity p { margin-bottom: 15px; }
|
||||
.block-type-activity ul li { margin-bottom: 5px; }
|
||||
.block-type-activity .note { display: block; margin-bottom: 15px; color: #aaa; }
|
||||
.block-type-profile-actions ul li a.followed { color: #f00; }
|
|
@ -251,6 +251,12 @@ jQuery(document).ready(function($){
|
|||
* Стена
|
||||
*/
|
||||
ls.wall.init();
|
||||
|
||||
|
||||
/**
|
||||
* Блок добавления пользователей
|
||||
*/
|
||||
ls.user_list_add.init();
|
||||
|
||||
|
||||
// Временный костыль для сабмита форм
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
{**
|
||||
* Выбор друзей для чтения в ленте активности
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends file='blocks/block.aside.base.tpl'}
|
||||
|
||||
{block name='block_title'}{$aLang.stream_block_users_friends}{/block}
|
||||
{block name='block_type'}activity{/block}
|
||||
|
||||
{block name='block_content'}
|
||||
{if $oUserCurrent}
|
||||
<small class="note">{$aLang.stream_settings_note_follow_friend}</small>
|
||||
|
||||
{if $aStreamFriends}
|
||||
<ul class="user-list-mini max-height-200 js-activity-block-users">
|
||||
{foreach $aStreamFriends as $oUser}
|
||||
{$iUserId = $oUser->getId()}
|
||||
|
||||
<li id="activity-block-users-item-{$iUserId}">
|
||||
<input class="input-checkbox"
|
||||
type="checkbox"
|
||||
{if isset($aStreamSubscribedUsers.$iUserId)}checked{/if}
|
||||
data-user-id="{$iUserId}" />
|
||||
<a href="{$oUser->getUserWebPath()}">{$oUser->getDisplayName()}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{else}
|
||||
<small class="note">{$aLang.stream_no_subscribed_users}</small>
|
||||
{/if}
|
||||
{/if}
|
||||
{/block}
|
|
@ -4,40 +4,15 @@
|
|||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends file='blocks/block.aside.base.tpl'}
|
||||
{extends 'blocks/block.aside.base.tpl'}
|
||||
|
||||
{block name='block_title'}{$aLang.stream_block_users_title}{/block}
|
||||
{block name='block_type'}activity{/block}
|
||||
{block 'block_title'}{$aLang.stream_block_users_title}{/block}
|
||||
{block 'block_type'}activity{/block}
|
||||
|
||||
{block name='block_content'}
|
||||
{if $oUserCurrent}
|
||||
<small class="note">{$aLang.stream_settings_note_follow_user}</small>
|
||||
|
||||
<div class="search-form">
|
||||
<div class="search-form-search">
|
||||
<input type="text" id="activity-block-users-input" autocomplete="off" placeholder="{$aLang.stream_block_config_append}" class="search-form-input autocomplete-users width-full" />
|
||||
<div onclick="ls.stream.appendUser();" class="search-form-submit icon-search"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $aStreamSubscribedUsers}
|
||||
<ul id="activity-block-users" class="user-list-mini max-height-200 js-activity-block-users">
|
||||
{foreach $aStreamSubscribedUsers as $oUser}
|
||||
{$iUserId = $oUser->getId()}
|
||||
|
||||
{if ! isset($aStreamFriends.$iUserId)}
|
||||
<li id="activity-block-users-item-{$iUserId}">
|
||||
<input type="checkbox"
|
||||
checked
|
||||
data-user-id="{$iUserId}" />
|
||||
<a href="{$oUser->getUserWebPath()}">{$oUser->getDisplayName()}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
{else}
|
||||
<ul id="activity-block-users" style="display: none;"></ul>
|
||||
<p id="activity-block-users-notice">{$aLang.stream_no_subscribed_users}</p>
|
||||
{/if}
|
||||
{/if}
|
||||
{block 'block_content'}
|
||||
{include 'user_list_add.tpl'
|
||||
iUserListId = $oUserCurrent->getId()
|
||||
sUserListType = 'activity'
|
||||
aUserList = $aStreamSubscribedUsers
|
||||
sUserListNote = $aLang.stream_settings_note_follow_user}
|
||||
{/block}
|
|
@ -11,33 +11,9 @@
|
|||
{block 'block_type'}blog-invite{/block}
|
||||
|
||||
{block 'block_content'}
|
||||
{* Форма добавления *}
|
||||
<form class="js-blog-invite-form mb-20" data-blog-id="{$oBlogEdit->getId()}">
|
||||
{include 'forms/fields/form.field.text.tpl'
|
||||
sFieldName = 'add'
|
||||
sFieldClasses = 'width-full autocomplete-users-sep js-blog-invite-form-users'
|
||||
sFieldLabel = $aLang.blog.invite.form.users_label}
|
||||
|
||||
{include 'forms/fields/form.field.button.tpl' sFieldText=$aLang.common.add sFieldStyle='primary' sFieldClasses='js-blog-invite-form-submit'}
|
||||
</form>
|
||||
|
||||
{* Список приглашенных *}
|
||||
<div class="js-blog-invite-container" {if ! $aBlogUsersInvited}style="display: none"{/if}>
|
||||
<h3>{$aLang.blog.invite.users_title}</h3>
|
||||
|
||||
<ul class="user-list-small js-blog-invite-users">
|
||||
{foreach $aBlogUsersInvited as $oBlogUser}
|
||||
{$oUser = $oBlogUser->getUser()}
|
||||
|
||||
<li class="user-list-small-item js-blog-invite-user" data-blog-id="{$oBlogEdit->getId()}" data-user-id="{$oUser->getId()}">
|
||||
{include 'user_item.tpl' oUser=$oUser}
|
||||
|
||||
<div class="user-list-small-item-actions">
|
||||
<a href="#" class="icon-repeat js-blog-invite-user-repeat" title="{$aLang.blog.invite.repeat}"></a>
|
||||
<a href="#" class="icon-remove js-blog-invite-user-remove" title="{$aLang.common.remove}"></a>
|
||||
</div>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{include 'user_list_add.tpl'
|
||||
sUserListType = 'blog_invite'
|
||||
iUserListId = $oBlogEdit->getId()
|
||||
aUserList = $aBlogUsersInvited
|
||||
sUserListSmallItemPath = 'user_list_small_item.blog_invite.tpl'}
|
||||
{/block}
|
|
@ -1,31 +0,0 @@
|
|||
{**
|
||||
* Выбор друзей для чтения в ленте
|
||||
*
|
||||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends file='blocks/block.aside.base.tpl'}
|
||||
|
||||
{block name='block_title'}{$aLang.userfeed_block_users_friends}{/block}
|
||||
{block name='block_type'}activity{/block}
|
||||
|
||||
|
||||
{if $oUserCurrent && count($aUserfeedFriends)}
|
||||
{block name='block_content'}
|
||||
<small class="note">{$aLang.userfeed_settings_note_follow_friend}</small>
|
||||
|
||||
<ul class="user-list-mini max-height-200 js-userfeed-block-users">
|
||||
{foreach $aUserfeedFriends as $oUser}
|
||||
{$iUserId = $oUser->getId()}
|
||||
|
||||
<li id="userfeed-block-users-item-{$iUserId}">
|
||||
<input class="input-checkbox"
|
||||
type="checkbox"
|
||||
data-user-id="{$iUserId}"
|
||||
{if isset($aUserfeedSubscribedUsers.$iUserId)} checked{/if} />
|
||||
<a href="{$oUser->getUserWebPath()}">{$oUser->getDisplayName()}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/block}
|
||||
{/if}
|
|
@ -4,42 +4,15 @@
|
|||
* @styles css/blocks.css
|
||||
*}
|
||||
|
||||
{extends file='blocks/block.aside.base.tpl'}
|
||||
{extends 'blocks/block.aside.base.tpl'}
|
||||
|
||||
{block name='block_title'}{$aLang.userfeed_block_users_title}{/block}
|
||||
{block name='block_type'}activity{/block}
|
||||
{block 'block_title'}{$aLang.userfeed_block_users_title}{/block}
|
||||
{block 'block_type'}activity{/block}
|
||||
|
||||
{if $oUserCurrent}
|
||||
{block name='block_content'}
|
||||
<small class="note">{$aLang.userfeed_settings_note_follow_user}</small>
|
||||
|
||||
<div class="stream-settings-userlist">
|
||||
<div class="search-form">
|
||||
<div class="search-form-search">
|
||||
<input type="text" id="userfeed-block-users-input" autocomplete="off" placeholder="{$aLang.userfeed_block_users_append}" class="search-form-input autocomplete-users width-full" />
|
||||
<div onclick="ls.userfeed.appendUser();" class="search-form-submit icon-search"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if count($aUserfeedSubscribedUsers)}
|
||||
<ul id="userfeed-block-users" class="user-list-mini max-height-200 js-userfeed-block-users">
|
||||
{foreach $aUserfeedSubscribedUsers as $oUser}
|
||||
{$iUserId = $oUser->getId()}
|
||||
|
||||
{if !isset($aUserfeedFriends.$iUserId)}
|
||||
<li id="userfeed-block-users-item-{$iUserId}">
|
||||
<input class="input-checkbox"
|
||||
type="checkbox"
|
||||
checked
|
||||
data-user-id="{$iUserId}" />
|
||||
<a href="{$oUser->getUserWebPath()}">{$oUser->getDisplayName()}</a>
|
||||
</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
{else}
|
||||
<ul id="userfeed_block_users_list"></ul>
|
||||
{/if}
|
||||
</div>
|
||||
{/block}
|
||||
{/if}
|
||||
{block 'block_content'}
|
||||
{include 'user_list_add.tpl'
|
||||
iUserListId = $oUserCurrent->getId()
|
||||
sUserListType = 'userfeed'
|
||||
aUserList = $aUserfeedSubscribedUsers
|
||||
sUserListNote = $aLang.userfeed_settings_note_follow_user}
|
||||
{/block}
|
|
@ -75,7 +75,7 @@
|
|||
|
||||
<script>
|
||||
ls.lang.load({json var = $aLangJs});
|
||||
ls.lang.load({lang_load name="blog.blog, favourite.add, favourite.remove, topic_question_create_answers_error_max, geo_select_city, geo_select_region, blog.add.fields.type.note_open, blog.add.fields.type.note_close"});
|
||||
ls.lang.load({lang_load name="blog.blog, favourite.add, favourite.remove, topic_question_create_answers_error_max, geo_select_city, geo_select_region, blog.add.fields.type.note_open, blog.add.fields.type.note_close, common.success.add, common.success.remove"});
|
||||
|
||||
ls.registry.set('comment_max_tree', {json var=$oConfig->Get('module.comment.max_tree')});
|
||||
ls.registry.set('block_stream_show_tip', {json var=$oConfig->Get('block.stream.show_tip')});
|
||||
|
|
38
application/frontend/skin/developer/user_list_add.tpl
Normal file
38
application/frontend/skin/developer/user_list_add.tpl
Normal file
|
@ -0,0 +1,38 @@
|
|||
{**
|
||||
* Пополняемый список пользователей
|
||||
*
|
||||
* TODO: Item active/inactive/selected
|
||||
*}
|
||||
|
||||
{* Форма добавления *}
|
||||
<div class="user-list-add js-user-list-add" data-type="{$sUserListType}" data-target-id="{$iUserListId}">
|
||||
{* Заголовок *}
|
||||
{if $sUserListTitle}
|
||||
<h3 class="user-list-add-title">{$sUserListTitle}</h3>
|
||||
{/if}
|
||||
|
||||
{* Описание *}
|
||||
{if $sUserListNote}
|
||||
<p class="user-list-add-note">{$sUserListNote}</p>
|
||||
{/if}
|
||||
|
||||
{* Форма добавления *}
|
||||
<form class="user-list-add-form js-user-list-add-form">
|
||||
{include 'forms/fields/form.field.text.tpl'
|
||||
sFieldName = 'add'
|
||||
sFieldClasses = 'width-full autocomplete-users-sep js-user-list-add-form-users'
|
||||
sFieldLabel = $aLang.blog.invite.fields.add.label
|
||||
sFieldNote = "<a href=\"#\" class=\"link-dotted\" data-type=\"modal-toggle\" data-modal-url=\"{router page='ajax/modal-friend-list'}\" data-param-selectable=\"true\">Выбрать из списка друзей</a>"}
|
||||
|
||||
{include 'forms/fields/form.field.button.tpl' sFieldText=$aLang.common.add sFieldStyle='primary' sFieldClasses='js-user-list-add-form-submit'}
|
||||
</form>
|
||||
|
||||
{* Список пользователей *}
|
||||
{* TODO: Изменить порядок вывода - сначало новые *}
|
||||
{include 'user_list_small.tpl'
|
||||
aUserList = $aUserList
|
||||
bUserListSmallShowActions = true
|
||||
bUserListDisplay = !! $aUserList
|
||||
sUserListSmallClasses = 'js-user-list-add-users'
|
||||
sUserListSmallItemClasses = 'js-user-list-add-user'}
|
||||
</div>
|
Loading…
Reference in a new issue