Also support plain window for adding friend & friend group #2154

This commit is contained in:
Kijin Sung 2023-07-17 21:50:04 +09:00
parent e635970c6a
commit 64b2918559
6 changed files with 95 additions and 30 deletions

View file

@ -76,6 +76,8 @@
'dispCommunicationFriend',
'dispCommunicationMessages',
'dispCommunicationSendMessage',
'dispCommunicationAddFriend',
'dispCommunicationAddFriendGroup',
'dispNcenterliteUserConfig',
'dispNcenterliteNotifyList',
'dispNcenterliteUnsubscribeList',

View file

@ -592,6 +592,12 @@ class communicationController extends communication
$this->setMessage('success_registed');
if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
{
if (Context::get('window_type') === 'self')
{
$this->setRedirectUrl(getNotEncodedUrl('', 'act', 'dispCommunicationFriend'));
}
else
{
global $lang;
htmlHeader();
@ -602,6 +608,7 @@ class communicationController extends communication
exit;
}
}
}
/**
* Move a group of the friend
@ -766,6 +773,12 @@ class communicationController extends communication
if(!$output->toBool())
{
if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
{
if (Context::get('window_type') === 'self')
{
$this->setRedirectUrl(getNotEncodedUrl('', 'act', 'dispCommunicationFriend'));
}
else
{
global $lang;
htmlHeader();
@ -775,6 +788,7 @@ class communicationController extends communication
Context::close();
exit;
}
}
else
{
return $output;
@ -783,6 +797,12 @@ class communicationController extends communication
else
{
if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
{
if (Context::get('window_type') === 'self')
{
$this->setRedirectUrl(getNotEncodedUrl('', 'act', 'dispCommunicationFriend'));
}
else
{
global $lang;
htmlHeader();
@ -793,6 +813,7 @@ class communicationController extends communication
Context::close();
exit;
}
}
else
{
$this->setMessage($msg_code);
@ -976,13 +997,15 @@ class communicationController extends communication
// Add a menu for sending message
if($config->enable_message == 'Y' && ($logged_info->is_admin == 'Y' || $target_member_info->allow_message == 'Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))))
{
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl), 'cmd_send_message', '', 'popup');
$url = getUrl('', 'mid', $mid, 'act', 'dispCommunicationSendMessage', 'receiver_srl', $member_srl, 'window_type', 'self');
$oMemberController->addMemberPopupMenu($url, 'cmd_send_message', '', 'self');
}
// Add a menu for listing friends (if a friend is new)
if($config->enable_friend == 'Y' && !$oCommunicationModel->isAddedFriend($member_srl))
{
$oMemberController->addMemberPopupMenu(getUrl('', 'mid', $mid, 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl), 'cmd_add_friend', '', 'popup');
$url = getUrl('', 'mid', $mid, 'act', 'dispCommunicationAddFriend', 'target_srl', $member_srl, 'window_type', 'self');
$oMemberController->addMemberPopupMenu($url, 'cmd_add_friend', '', 'self');
}
}
}

View file

@ -373,9 +373,23 @@ class communicationView extends communication
* @return void|Object (void : success, Object : fail)
*/
function dispCommunicationAddFriend()
{
// If window type is self, use member module layout.
// Otherwise, assume it's a popup window on PC for backward compatibility.
if(Context::get('window_type') === 'self')
{
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
}
elseif(!Context::get('m'))
{
$this->setLayoutPath('./common/tpl/');
$this->setLayoutFile("popup_layout");
}
if($this->config->enable_friend == 'N')
{
@ -431,9 +445,23 @@ class communicationView extends communication
* @return void|Object (void : success, Object : fail)
*/
function dispCommunicationAddFriendGroup()
{
// If window type is self, use member module layout.
// Otherwise, assume it's a popup window on PC for backward compatibility.
if(Context::get('window_type') === 'self')
{
$oMemberView = MemberView::getInstance();
if (!$oMemberView->checkMidAndRedirect())
{
$this->setRedirectUrl($oMemberView->getRedirectUrl());
return;
}
}
elseif(!Context::get('m'))
{
$this->setLayoutPath('./common/tpl/');
$this->setLayoutFile("popup_layout");
}
if($this->config->enable_friend == 'N')
{

View file

@ -1,6 +1,11 @@
<load target="filter/add_friend.xml" />
<load target="css/communication.css" />
<load target="js/communication.js" />
<!--@if(isset($window_type) && $window_type === 'self')-->
<include target="./common_header.html" />
<!--@endif-->
<div class="xc">
<h1>{$lang->cmd_add_friend}</h1>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/communication/skins/default/add_friend/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
@ -11,6 +16,7 @@
<input type="hidden" name="act" value="procCommunicationAddFriend" />
<input type="hidden" name="target_srl" value="{$target_info->member_srl}" />
<input type="hidden" name="xe_validator_id" value="modules/communication/skins/default/add_friend/1" />
<input type="hidden" name="window_type" value="{escape($window_type ?? '')}" />
<table class="table table-striped table-hover">
<tr>
<th scope="row">{$lang->nick_name}</th>

View file

@ -1,5 +1,10 @@
<load target="css/communication.css" />
<load target="js/communication.js" />
<!--@if(isset($window_type) && $window_type === 'self')-->
<include target="./common_header.html" />
<!--@endif-->
<div class="xc">
<h1 style="border-bottom:1px solid #ccc">
<!--@if($friend_group->friend_group_srl)-->
@ -16,6 +21,7 @@
<input type="hidden" name="act" value="procCommunicationAddFriendGroup" />
<input type="hidden" name="friend_group_srl" value="{$friend_group->friend_group_srl}" />
<input type="hidden" name="xe_validator_id" value="modules/communication/skins/default/add_friend_group/1" />
<input type="hidden" name="window_type" value="{escape($window_type ?? '')}" />
<div class="control-group">
<label for="title" class="control-label">{$lang->msg_insert_group_name}</label>
<div class="controls"><input name="title" id="title" type="text" value="{htmlspecialchars($friend_group->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}"/></div>

View file

@ -26,7 +26,7 @@
<span class="btn-group">
<button type="button" class="btn" cond="count($friend_group_list)" onclick="doRenameFriendGroup();return false;">{$lang->cmd_rename_friend_group}</button>
<button type="button" class="btn" cond="count($friend_group_list)" onclick="doDeleteFriendGroup();return false;">{$lang->cmd_delete_friend_group}</button>
<a href="{getUrl('','module','communication','act','dispCommunicationAddFriendGroup')}" class="btn" onclick="popopen(this.href);return false;">{$lang->cmd_add_friend_group}</a>
<a href="{getUrl('','module','communication','act','dispCommunicationAddFriendGroup','window_type','self')}" class="btn">{$lang->cmd_add_friend_group}</a>
</span>
</div>