Added user context menu

Leandro Silva [09-22-18 - 12:43]
Added user context menu
Filename
LeoGuildManager.lua
LeoGuildManager.txt
LeoGuildManager.xml
LeoGuildManagerUI.lua
diff --git a/LeoGuildManager.lua b/LeoGuildManager.lua
index 2f90d29..0c11489 100644
--- a/LeoGuildManager.lua
+++ b/LeoGuildManager.lua
@@ -2,7 +2,7 @@
 LeoGM = {}
 LeoGM.name = "LeoGuildManager"
 LeoGM.displayName = "Leo's Guild Manager"
-LeoGM.version = "0.9.2"
+LeoGM.version = "0.9.3"
 LeoGM.chatPrefix = "|c39B027" .. LeoGM.name .. "|r: "
 LeoGM.panelList = { "Rules", "Purge" }
 LeoGM.members = {}
diff --git a/LeoGuildManager.txt b/LeoGuildManager.txt
index e1e1243..0d567f3 100644
--- a/LeoGuildManager.txt
+++ b/LeoGuildManager.txt
@@ -1,6 +1,6 @@
 ## Title: Leo's Guild Manager
 ## APIVersion: 100024
-## Version: 0.9.2
+## Version: 0.9.3
 ## Author: |c39B027@LeandroSilva|r
 ## SavedVariables: LeoGMSavedVariables
 ## DependsOn: LibStub LibFeedback MasterMerchant
diff --git a/LeoGuildManager.xml b/LeoGuildManager.xml
index 10ce82b..edda413 100644
--- a/LeoGuildManager.xml
+++ b/LeoGuildManager.xml
@@ -304,9 +304,10 @@
             <Controls>
                 <Texture name="$(parent)BG" inherits="ZO_ThinListBgStrip" />

-                <Label name="$(parent)Name" font="ZoFontGame" color="ffffff" verticalAlignment="CENTER">
+                <Label name="$(parent)Name" font="ZoFontGame" color="ffffff" verticalAlignment="CENTER" mouseEnabled="true">
                     <Dimensions x="250" y="32" />
                     <Anchor point="TOPLEFT" relativeTo="$(parent)BG" relativePoint="TOPLEFT"/>
+                    <OnMouseUp> LeoGM.UserClick(self, button, upInside) </OnMouseUp>
                 </Label>
                 <Label name="$(parent)Deposits" font="ZoFontGame" verticalAlignment="CENTER">
                     <Dimensions x="100" y="32" />
diff --git a/LeoGuildManagerUI.lua b/LeoGuildManagerUI.lua
index d35c2f8..550cae5 100644
--- a/LeoGuildManagerUI.lua
+++ b/LeoGuildManagerUI.lua
@@ -28,12 +28,34 @@ function LeoGMMemberList:New(control)
     return self
 end

+function LeoGM.UserClick(control, button, upInside)
+    local player = control.data
+    local guildId = LeoGM.GetGuilds(LeoGM.savedVariables.selectedGuild)
+    if type(player) == 'string' and button == MOUSE_BUTTON_INDEX_RIGHT then
+        ClearMenu()
+        AddMenuItem(GetString(SI_SOCIAL_LIST_SEND_MESSAGE), function() StartChatInput(nil, CHAT_CHANNEL_WHISPER, player) end)
+        AddMenuItem(GetString(SI_SOCIAL_MENU_SEND_MAIL), function() MAIL_SEND:ComposeMailTo(player) end)
+        if DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_NOTE_EDIT) then
+            -- Soon
+            --AddMenuItem(GetString(SI_SOCIAL_MENU_EDIT_NOTE), LeoGM.EditMemberNote(control, player))
+        end
+        if DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_DEMOTE) then
+            AddMenuItem(GetString(SI_GUILD_DEMOTE), GuildDemote(guildId, player))
+        end
+        if DoesPlayerHaveGuildPermission(guildId, GUILD_PERMISSION_REMOVE) then
+            AddMenuItem(GetString(SI_GUILD_REMOVE), GuildRemove(guildId, player))
+        end
+        ShowMenu(control)
+    end
+end
+
 function LeoGMMemberList:SetupEntry(control, data)

     control.data = data

     control.name = GetControl(control, "Name")
     control.name:SetText(data.name)
+    control.name.data = data.name

     control.deposits = GetControl(control, "Deposits")
     control.deposits:SetText(data.deposits)