FIRE-30725 - Add more group functions to group URL context menu
parent
1287f3afa1
commit
edc771b71a
|
|
@ -44,7 +44,12 @@ enum EFSRegistrarFunctionActionType
|
|||
FS_RGSTR_ACT_REQUEST_TELEPORT,
|
||||
FS_RGSTR_CHK_AVATAR_BLOCKED,
|
||||
FS_RGSTR_CHK_IS_SELF,
|
||||
FS_RGSTR_CHK_IS_NOT_SELF
|
||||
FS_RGSTR_CHK_IS_NOT_SELF,
|
||||
FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA,
|
||||
FS_RGSTR_CHK_HAVE_GROUP_DATA,
|
||||
FS_RGSTR_CHK_CAN_LEAVE_GROUP,
|
||||
FS_RGSTR_CHK_CAN_JOIN_GROUP,
|
||||
FS_RGSTR_CHK_GROUP_NOT_ACTIVE
|
||||
};
|
||||
|
||||
class FSRegistrarUtils
|
||||
|
|
|
|||
|
|
@ -2114,6 +2114,20 @@ BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
|
|||
enable_registrar.add("FS.EnableViewLog", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_ACT_VIEW_TRANSCRIPT));
|
||||
// </FS:Ansariel>
|
||||
|
||||
// <FS:Zi> FIRE-30725 - Add more group functions to group URL context menu
|
||||
std::string uuid_str = uuid.asString();
|
||||
|
||||
registrar.add("FS.JoinGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + uuid_str + "/groupjoin", true));
|
||||
registrar.add("FS.LeaveGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + uuid_str + "/groupleave", true));
|
||||
registrar.add("FS.ActivateGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + uuid_str + "/groupactivate", true));
|
||||
|
||||
enable_registrar.add("FS.WaitingForGroupData", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA));
|
||||
enable_registrar.add("FS.HaveGroupData", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_HAVE_GROUP_DATA));
|
||||
enable_registrar.add("FS.EnableJoinGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_CAN_JOIN_GROUP));
|
||||
enable_registrar.add("FS.EnableLeaveGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_CAN_LEAVE_GROUP));
|
||||
enable_registrar.add("FS.EnableActivateGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, uuid, FS_RGSTR_CHK_GROUP_NOT_ACTIVE));
|
||||
// </FS:Zi>
|
||||
|
||||
// create the context menu from the XUI file and display it
|
||||
std::string menu_name = is_group ? "menu_url_group.xml" : "menu_url_agent.xml";
|
||||
delete mPopupMenu;
|
||||
|
|
|
|||
|
|
@ -2144,6 +2144,18 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
|
|||
enable_registrar.add("FS.EnableViewLog", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_ACT_VIEW_TRANSCRIPT));
|
||||
// </FS:Ansariel>
|
||||
|
||||
// <FS:Zi> FIRE-30725 - Add more group functions to group URL context menu
|
||||
registrar.add("FS.JoinGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupjoin", true));
|
||||
registrar.add("FS.LeaveGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupleave", true));
|
||||
registrar.add("FS.ActivateGroup", boost::bind(&LLUrlAction::executeSLURL, "secondlife:///app/firestorm/" + target_id_str + "/groupactivate", true));
|
||||
|
||||
enable_registrar.add("FS.WaitingForGroupData", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA));
|
||||
enable_registrar.add("FS.HaveGroupData", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_HAVE_GROUP_DATA));
|
||||
enable_registrar.add("FS.EnableJoinGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_CAN_JOIN_GROUP));
|
||||
enable_registrar.add("FS.EnableLeaveGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_CAN_LEAVE_GROUP));
|
||||
enable_registrar.add("FS.EnableActivateGroup", boost::bind(&FSRegistrarUtils::checkIsEnabled, gFSRegistrarUtils, target_id, FS_RGSTR_CHK_GROUP_NOT_ACTIVE));
|
||||
// </FS:Zi>
|
||||
|
||||
// create and return the context menu from the XUI file
|
||||
|
||||
LLContextMenu* menu = static_cast<LLContextMenu*>(mPopupMenuHandle.get());
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
#include "llavataractions.h"
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llfloaterperms.h"
|
||||
#include "llgroupactions.h"
|
||||
#include "llgroupmgr.h"
|
||||
#include "llinventorymodel.h"
|
||||
#include "lllogchat.h"
|
||||
#include "llmutelist.h"
|
||||
|
|
@ -316,6 +318,16 @@ bool FSCommon::isLinden(const LLUUID& av_id)
|
|||
last_name == LL_TESTER);
|
||||
}
|
||||
|
||||
// request group data from the server if it's not already cached
|
||||
bool FSCommon::requestGroupData(const LLUUID& groupID)
|
||||
{
|
||||
if (LLGroupMgr::getInstance()->getGroupData(groupID) == nullptr)
|
||||
{
|
||||
LLGroupMgr::getInstance()->sendGroupPropertiesRequest(groupID);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FSCommon::checkIsActionEnabled(const LLUUID& av_id, EFSRegistrarFunctionActionType action)
|
||||
{
|
||||
|
|
@ -373,6 +385,52 @@ bool FSCommon::checkIsActionEnabled(const LLUUID& av_id, EFSRegistrarFunctionAct
|
|||
{
|
||||
return !isSelf;
|
||||
}
|
||||
else if (action == FS_RGSTR_CHK_WAITING_FOR_GROUP_DATA)
|
||||
{
|
||||
return !requestGroupData(av_id);
|
||||
}
|
||||
else if (action == FS_RGSTR_CHK_HAVE_GROUP_DATA)
|
||||
{
|
||||
return requestGroupData(av_id);
|
||||
}
|
||||
else if (action == FS_RGSTR_CHK_CAN_LEAVE_GROUP)
|
||||
{
|
||||
if (gAgent.getGroupID() == av_id && !RlvActions::canChangeActiveGroup())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return gAgent.isInGroup(av_id);
|
||||
}
|
||||
else if (action == FS_RGSTR_CHK_CAN_JOIN_GROUP)
|
||||
{
|
||||
if (!gAgent.canJoinGroups())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!RlvActions::canChangeActiveGroup())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LLGroupMgrGroupData* groupData = LLGroupMgr::getInstance()->getGroupData(av_id);
|
||||
if (!groupData || !groupData->mOpenEnrollment)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return !gAgent.isInGroup(av_id);
|
||||
}
|
||||
else if (action == FS_RGSTR_CHK_GROUP_NOT_ACTIVE)
|
||||
{
|
||||
if (!RlvActions::canChangeActiveGroup())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (gAgent.isInGroup(av_id) && gAgent.getGroupID() != av_id);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ namespace FSCommon
|
|||
*/
|
||||
extern S32 sObjectAddMsg;
|
||||
|
||||
// request group data from the server if it's not already cached
|
||||
bool requestGroupData(const LLUUID& groupID);
|
||||
|
||||
bool checkIsActionEnabled(const LLUUID& av_id, EFSRegistrarFunctionActionType);
|
||||
LLSD populateGroupCount();
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "llavataractions.h"
|
||||
#include "llcommandhandler.h"
|
||||
#include "llfloatersettingsdebug.h"
|
||||
#include "llgroupactions.h"
|
||||
#include "lllogchat.h"
|
||||
#include "llnotificationsutil.h"
|
||||
|
||||
|
|
@ -135,6 +136,24 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
if (verb == "groupjoin")
|
||||
{
|
||||
LLGroupActions::join(LLUUID(target_id));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (verb == "groupleave")
|
||||
{
|
||||
LLGroupActions::leave(LLUUID(target_id));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (verb == "groupactivate")
|
||||
{
|
||||
LLGroupActions::activate(LLUUID(target_id));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,6 +11,58 @@
|
|||
</menu_item_call>
|
||||
<menu_item_separator
|
||||
layout="topleft" />
|
||||
|
||||
<!-- <FS:Zi> FIRE-30725 - Add more group functions to group URL context menu -->
|
||||
<!-- menu entry to call internal request for group data - this will make sure the
|
||||
rest of the functions can actually do something once the data is loaded -->
|
||||
<menu_item_call
|
||||
label="Fetching Group Data, please try again!"
|
||||
layout="topleft"
|
||||
enabled="false"
|
||||
name="waiting_for_group_data">
|
||||
<menu_item_call.on_visible
|
||||
function="FS.WaitingForGroupData" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Activate Group"
|
||||
layout="topleft"
|
||||
visible="false"
|
||||
name="activate_group">
|
||||
<menu_item_call.on_click
|
||||
function="FS.ActivateGroup" />
|
||||
<menu_item_call.on_visible
|
||||
function="FS.HaveGroupData" />
|
||||
<menu_item_call.on_enable
|
||||
function="FS.EnableActivateGroup" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Join Group"
|
||||
layout="topleft"
|
||||
visible="false"
|
||||
name="join_group">
|
||||
<menu_item_call.on_click
|
||||
function="FS.JoinGroup" />
|
||||
<menu_item_call.on_visible
|
||||
function="FS.HaveGroupData" />
|
||||
<menu_item_call.on_enable
|
||||
function="FS.EnableJoinGroup" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Leave Group"
|
||||
layout="topleft"
|
||||
visible="false"
|
||||
name="leave_group">
|
||||
<menu_item_call.on_click
|
||||
function="FS.LeaveGroup" />
|
||||
<menu_item_call.on_visible
|
||||
function="FS.HaveGroupData" />
|
||||
<menu_item_call.on_enable
|
||||
function="FS.EnableLeaveGroup" />
|
||||
</menu_item_call>
|
||||
<menu_item_separator
|
||||
layout="topleft" />
|
||||
<!-- </FS:Zi> -->
|
||||
|
||||
<menu_item_call
|
||||
label="Copy Group to clipboard"
|
||||
layout="topleft"
|
||||
|
|
|
|||
Loading…
Reference in New Issue