Back to Home

ESO Lua File v100033

ingame/housingeditor/keyboard/housingfurnituresettings_keyboard.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
ZO_KEYBOARD_HOUSING_SETTINGS_DISPLAY_NAME_WIDTH = 300
ZO_KEYBOARD_HOUSING_SETTINGS_PERMISSIONS_WIDTH = 290
ZO_HousingFurnitureSettings_Keyboard = ZO_Object.MultiSubclass(ZO_HousingFurnitureSettings_Base, ZO_HousingBrowserList)
function ZO_HousingFurnitureSettings_Keyboard:New(...)
    return ZO_HousingFurnitureSettings_Base.New(self, ...)
end
function ZO_HousingFurnitureSettings_Keyboard:Initialize(...)
    ZO_HousingFurnitureSettings_Base.Initialize(self, ...)
    ZO_HousingBrowserList.Initialize(self, ...)
    self.settingsTreeData = ZO_RootFurnitureCategory:New()
        
    for name,topLevelSetting in pairs(ZO_FURNITURE_SETTINGS) do
        local subsettingsTreeData = ZO_FurnitureCategory:New(self.settingsTreeData, name)
        self.settingsTreeData:AddSubcategory(name, subsettingsTreeData)
        for _,i in pairs(topLevelSetting) do
            subsettingsTreeData:AddSubcategory(i, ZO_FurnitureCategory:New(subsettingsTreeData, i))
        end
    end
    SYSTEMS:RegisterKeyboardObject("furniture_settings", self)
end
function ZO_HousingFurnitureSettings_Keyboard:InitializeSettingsPanels()
    self.categoryIndexToPanel = {}
    self.generalOptionsPanel = self.contents:GetNamedChild("General")
    self.categoryIndexToPanel[HOUSE_PERMISSION_OPTIONS_CATEGORIES_GENERAL] = self.generalOptionsPanel
    self.activePanel = self.generalOptionsPanel
    self.generalOptionsScrollList = self.generalOptionsPanel:GetNamedChild("Settings")
    local generalOptionsScrollChild = GetControl(self.generalOptionsScrollList, "ScrollChild")
    local function OnPrimaryResidenceClicked(button)
        self:SetPrimaryResidence()
    end
    self.primaryResidenceSetting = self.generalOptionsPanel:GetNamedChild("PrimaryResidence")
    self.primaryResidenceSetting:SetParent(generalOptionsScrollChild)
    self.primaryResidenceButton = self.primaryResidenceSetting:GetNamedChild("Button")
    self.primaryResidenceButton:SetHandler("OnClicked", OnPrimaryResidenceClicked)
    local primaryResidenceButtonLabel = self.primaryResidenceButton:GetLabelControl()
    primaryResidenceButtonLabel:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
    self.defaultAccessSetting = self.generalOptionsPanel:GetNamedChild("DefaultAccess")
    self.defaultAccessSetting:SetParent(generalOptionsScrollChild)
    self.defaultAccessDropDown = self.defaultAccessSetting:GetNamedChild("DropDown")
    self:BuildDefaultAccessSettings(self.defaultAccessSetting)
    local function OnRestartPathsClicked()
        self:RestartPaths()
    end
    self.restartPathsSetting = self.generalOptionsPanel:GetNamedChild("ResetPaths")
    self.restartPathsSetting:SetParent(generalOptionsScrollChild)
    self.restartPathsButton = self.restartPathsSetting:GetNamedChild("Button")
    self.restartPathsButton:SetHandler("OnClicked", OnRestartPathsClicked)
    local restartPathsButtonLabel = self.restartPathsButton:GetLabelControl()
    restartPathsButtonLabel:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
    self.visitorsOptionsPanel = self.contents:GetNamedChild("Visitors")
    self.visitorsSocialList = ZO_HousingSettingsVisitorList_Keyboard:New(self.visitorsOptionsPanel, self, ZO_SETTINGS_VISITOR_DATA_TYPE, "ZO_HousingSettings_WhiteList_Row")
    self.visitorsOptionsPanel.list = self.visitorsSocialList
    self.categoryIndexToPanel[HOUSE_PERMISSION_OPTIONS_CATEGORIES_VISITORS] = self.visitorsOptionsPanel
    self.banListOptionsPanel = self.contents:GetNamedChild("BanList")
    self.banListSocialList = ZO_HousingSettingsBanList_Keyboard:New(self.banListOptionsPanel, self, ZO_SETTINGS_BANLIST_DATA_TYPE, "ZO_HousingSettings_BanList_Row")
    self.banListOptionsPanel.list = self.banListSocialList
    self.categoryIndexToPanel[HOUSE_PERMISSION_OPTIONS_CATEGORIES_BANLIST] = self.banListOptionsPanel
    self.guildVisitorsOptionsPanel = self.contents:GetNamedChild("GuildVisitors")
    self.guildVisitorsSocialList = ZO_HousingSettingsGuildVisitorList_Keyboard:New(self.guildVisitorsOptionsPanel, self, ZO_SETTINGS_GUILD_VISITOR_DATA_TYPE, "ZO_HousingSettings_WhiteList_Row")
    self.guildVisitorsOptionsPanel.list = self.guildVisitorsSocialList
    self.categoryIndexToPanel[HOUSE_PERMISSION_OPTIONS_CATEGORIES_GUILD_VISITORS] = self.guildVisitorsOptionsPanel
    self.guildBanListOptionsPanel = self.contents:GetNamedChild("GuildBanList")
    self.guildBanListSocialList = ZO_HousingSettingsGuildBanList_Keyboard:New(self.guildBanListOptionsPanel, self, ZO_SETTINGS_GUILD_BANLIST_DATA_TYPE, "ZO_HousingSettings_BanList_Row")
    self.guildBanListOptionsPanel.list = self.guildBanListSocialList 
    self.categoryIndexToPanel[HOUSE_PERMISSION_OPTIONS_CATEGORIES_GUILD_BANLIST] = self.guildBanListOptionsPanel
end
function ZO_HousingFurnitureSettings_Keyboard:InitializeKeybindStrip()
    self.keybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_CENTER,
        -- Add Player
        {
            name = function()
                        if self.activePanel == self.visitorsOptionsPanel or self.activePanel == self.banListOptionsPanel then
                            return GetString(SI_HOUSING_FURNITURE_SETTINGS_ADD_PLAYER_KEYBIND)
                        elseif self.activePanel == self.guildVisitorsOptionsPanel or self.activePanel == self.guildBanListOptionsPanel then
                            return GetString(SI_HOUSING_FURNITURE_SETTINGS_ADD_GUILD_KEYBIND)
                        end
                   end,
            keybind = "UI_SHORTCUT_SECONDARY",
        
            callback = function()
                local data = { activePanel = self.activePanel.list, currentHouse = GetCurrentZoneHouseId() }
                if self.activePanel == self.visitorsOptionsPanel then
                    ZO_Dialogs_ShowDialog("REQUEST_ADD_INDIVIDUAL_PERMISSION", data)
                elseif self.activePanel == self.banListOptionsPanel then
                    ZO_Dialogs_ShowDialog("REQUEST_BAN_INDIVIDUAL_PERMISSION", data)
                elseif self.activePanel == self.guildVisitorsOptionsPanel then
                    ZO_Dialogs_ShowDialog("REQUEST_ADD_GUILD_PERMISSION", data)
                elseif self.activePanel == self.guildBanListOptionsPanel then
                    ZO_Dialogs_ShowDialog("REQUEST_BAN_GUILD_PERMISSION", data)
                end
            end,
            enabled = function()
                if self.activePanel == self.visitorsOptionsPanel or self.activePanel == self.banListOptionsPanel then
                    local numPermissions = self:GetNumIndividualPermissions(GetCurrentZoneHouseId())
                    local hasPermissionSlots = HOUSING_MAX_INDIVIDUAL_USER_GROUP_ENTRIES > numPermissions
                    return hasPermissionSlots, GetString(SI_PERMISSION_ERROR_CANT_ADD_NEW_INDIVIDUAL)
                elseif self.activePanel == self.guildVisitorsOptionsPanel or self.activePanel == self.guildBanListOptionsPanel then
                    local numPermissions = self:GetNumGuildPermissions(GetCurrentZoneHouseId())
                    local hasPermissionSlots = HOUSING_MAX_GUILD_USER_GROUP_ENTRIES > numPermissions
                    return hasPermissionSlots, GetString(SI_PERMISSION_ERROR_CANT_ADD_NEW_GUILD)
                end
                return false
            end,
            visible = function()
                return self.activePanel ~= self.generalOptionsPanel
            end
        },
        -- Load Permissions
        {
            name = GetString(SI_HOUSING_FURNITURE_SETTINGS_LOAD_PERMISSIONS_KEYBIND),
            keybind = "UI_SHORTCUT_TERTIARY",
        
            callback = function()
                self:TryShowCopyDialog()
            end,
        },
    }
end
function ZO_HousingFurnitureSettings_Keyboard:ShowCopyDialog(data)
    ZO_Dialogs_ShowDialog("COPY_HOUSING_PERMISSIONS", data)
end
function ZO_HousingFurnitureSettings_Keyboard:UpdateGeneralSettings()
    self.primaryResidence = GetHousingPrimaryHouse()
    local currentHouse = GetCurrentZoneHouseId()
    self:UpdateButtonSettings(self.primaryResidenceSetting)
    self.primaryResidenceButton:SetEnabled(self.primaryResidence ~= currentHouse)
    self:UpdateButtonSettings(self.restartPathsSetting)
    self.restartPathsButton:SetEnabled(SHARED_FURNITURE:HasAnyPathNodes())
    local defaultAccess = HOUSE_SETTINGS_MANAGER:GetDefaultHousingPermission(currentHouse)
    self.comboBox:SetSelectedItemText(GetString("SI_HOUSEPERMISSIONDEFAULTACCESSSETTING", defaultAccess))
end
function ZO_HousingFurnitureSettings_Keyboard:UpdateSingleVisitorSettings()
    self.visitorsSocialList:RefreshData()
    self.banListSocialList:RefreshData()
end
function ZO_HousingFurnitureSettings_Keyboard:UpdateGuildVisitorSettings()
    self.guildVisitorsSocialList:RefreshData()
    self.guildBanListSocialList:RefreshData()
end
do
    local CAN_ACCESS = true
    local function GetStringFromData(data)
        local dataType = type(data)
        if dataType == "function" then
            return data()
        elseif dataType == "number" then
            return GetString(data)
        else
            return data
        end
    end
    function ZO_HousingFurnitureSettings_Keyboard:UpdateButtonSettings(control)
        local data = control.data
        local buttonControl = GetControl(control, "Button")
        local nameControl = GetControl(control, "Name")
        local buttonText = GetStringFromData(data.buttonText)
        buttonControl:SetText(buttonText)
        local labelText = GetStringFromData(data.text)
        nameControl:SetText(labelText)
    end
    function ZO_HousingFurnitureSettings_Keyboard:BuildDefaultAccessSettings(control)
        local data = control.data
        local dropDownControl = GetControl(control, "DropDown")
        local nameControl = GetControl(control, "Name")
        local labelText = GetStringFromData(data.text)
        nameControl:SetText(labelText)
        local comboBox = ZO_ComboBox_ObjectFromContainer(dropDownControl)
        self.comboBox = comboBox
        comboBox:SetSortsItems(false)
        local function OnPresetSelected(_, entryText, entry)
            comboBox:SetSelectedItemText(entry.name)
            local canAccess, preset = HOUSE_SETTINGS_MANAGER:GetHousingPermissionsFromDefaultAccess(entry.defaultAccess)
            AddHousingPermission(GetCurrentZoneHouseId(), HOUSE_PERMISSION_USER_GROUP_GENERAL, canAccess, preset, false)
        end
        local allDefaultAccessSettings = HOUSE_SETTINGS_MANAGER:GetAllDefaultAccessSettings()
        for i = HOUSE_PERMISSION_DEFAULT_ACCESS_SETTING_ITERATION_BEGIN, HOUSE_PERMISSION_DEFAULT_ACCESS_SETTING_ITERATION_END do
            local entry = comboBox:CreateItemEntry(allDefaultAccessSettings[i], OnPresetSelected)
            entry.defaultAccess = i
            comboBox:AddItem(entry)
        end
    end
end
function ZO_HousingFurnitureSettings_Keyboard:GetCategoryTreeData()
    return self.settingsTreeData
end
function ZO_HousingFurnitureSettings_Keyboard:OnCategorySelected(data)
    local categoryPanel = self.categoryIndexToPanel[data.categoryId]
    if categoryPanel then
        self:SetActivePanel(categoryPanel)
    end
end
do
    local IS_HIDDEN = true
    function ZO_HousingFurnitureSettings_Keyboard:SetActivePanel(panel)
        if self.activePanel ~= panel then
            self.activePanel:SetHidden(IS_HIDDEN)
            self.activePanel = panel
            panel:SetHidden(not IS_HIDDEN)
            KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
        end
    end
end
function ZO_HousingFurnitureSettings_Keyboard:ShowDefaultAccessTooltip(control)
    local defaultAccess = HOUSE_SETTINGS_MANAGER:GetDefaultHousingPermission(GetCurrentZoneHouseId())
    InitializeTooltip(InformationTooltip, control, BOTTOMLEFT, 0, -2, TOPLEFT)
    local r,g,b = ZO_NORMAL_TEXT:UnpackRGB()
    InformationTooltip:AddLine(GetString(SI_HOUSING_FURNITURE_SETTINGS_GENERAL_DEFAULT_ACCESS_TOOLTIP_TEXT), "", r, g, b)
    local selectionTitle = GetString("SI_HOUSEPERMISSIONDEFAULTACCESSSETTING",  defaultAccess)
    local selectionDescription = GetString("SI_HOUSEPERMISSIONDEFAULTACCESSSETTING_DESCRIPTION", defaultAccess)
    InformationTooltip:AddLine(selectionTitle)
    InformationTooltip:AddLine(selectionDescription, "", r, g, b)
end
function ZO_HousingFurnitureSettings_Keyboard:ShowPrimaryResidenceTooltip(control)
    InitializeTooltip(InformationTooltip, control, BOTTOMLEFT, 0, -2, TOPLEFT)
    InformationTooltip:AddLine(GetString(SI_HOUSING_FURNITURE_SETTINGS_GENERAL_PRIMARY_RESIDENCE_BUTTON_TEXT))
    InformationTooltip:AddLine(GetString(SI_HOUSING_FURNITURE_SETTINGS_GENERAL_PRIMARY_RESIDENCE_TOOLTIP_TEXT), "", ZO_NORMAL_TEXT:UnpackRGB())
end
function ZO_HousingFurnitureSettings_Keyboard:ShowHomeShowTooltip(control)
    InitializeTooltip(InformationTooltip, control, BOTTOMLEFT, 0, -2, TOPLEFT)
    SetTooltipText(InformationTooltip, GetString(SI_HOUSING_FURNITURE_SETTINGS_GENERAL_HOMESHOW_TOOLTIP_TEXT))
end
function ZO_HousingFurnitureSettings_Keyboard:ShowRestartPathsTooltip(control)
    InitializeTooltip(InformationTooltip, control, BOTTOMLEFT, 0, -2, TOPLEFT)
    SetTooltipText(InformationTooltip, GetString(SI_HOUSING_FURNITURE_SETTINGS_GENERAL_RESTART_PATHS_TOOLTIP_TEXT))
end
-- XML Functions
-------------------
end
end
    if button == MOUSE_BUTTON_INDEX_RIGHT and upInside then
        ClearMenu()
        local data = ZO_ScrollList_GetData(control)
        if data.dataEntry.typeId == ZO_SETTINGS_VISITOR_DATA_TYPE or data.dataEntry.typeId == ZO_SETTINGS_GUILD_VISITOR_DATA_TYPE then
            AddMenuItem(GetString(SI_HOUSING_PERMISSIONS_OPTIONS_CHANGE_PERMISSIONS), function() ZO_Dialogs_ShowDialog("CHANGE_HOUSING_PERMISSIONS", data) end)
            local headerText
            local titleText
            if data.dataEntry.typeId == ZO_SETTINGS_VISITOR_DATA_TYPE  then
                 headerText = zo_strformat(SI_DIALOG_TEXT_REMOVE_INDIVIDUAL_PERMISSION, data.displayName)
                 titleText = GetString(SI_DIALOG_TITLE_REMOVE_INDIVIDUAL_PERMISSION)
            elseif data.dataEntry.typeId == ZO_SETTINGS_GUILD_VISITOR_DATA_TYPE then
                headerText = zo_strformat(SI_DIALOG_TEXT_REMOVE_GUILD_PERMISSION, data.displayName)
                titleText = GetString(SI_DIALOG_TITLE_REMOVE_GUILD_PERMISSION)
            end
            AddMenuItem(GetString(SI_HOUSING_PERMISSIONS_OPTIONS_REMOVE), function() ZO_Dialogs_ShowDialog("CONFIRM_REMOVE_PERMISSIONS", { titleText = titleText, headerText = headerText, currentHouse = data.currentHouse, userGroup = data.userGroup, index = data.index }) end)
            control.panel:ShowMenu(control)
        end
    end
end
    local headerText
    local titleText
    local data = ZO_ScrollList_GetData(control)
    if data.dataEntry.typeId == ZO_SETTINGS_BANLIST_DATA_TYPE or data.dataEntry.typeId == ZO_SETTINGS_GUILD_BANLIST_DATA_TYPE then
        if data.dataEntry.typeId == ZO_SETTINGS_BANLIST_DATA_TYPE then
            headerText = zo_strformat(SI_DIALOG_TEXT_REMOVE_BANLIST_INDIVIDUAL_PERMISSION, data.displayName)
            titleText = GetString(SI_DIALOG_TITLE_REMOVE_BANLIST_INDIVIDUAL_PERMISSION)
        elseif data.dataEntry.typeId == ZO_SETTINGS_GUILD_BANLIST_DATA_TYPE then
            headerText = zo_strformat(SI_DIALOG_TEXT_REMOVE_BANLIST_GUILD_PERMISSION, data.displayName)
            titleText = GetString(SI_DIALOG_TITLE_REMOVE_BANLIST_GUILD_PERMISSION)
        end
        ZO_Dialogs_ShowDialog("CONFIRM_REMOVE_PERMISSIONS", { titleText = titleText, headerText = headerText, currentHouse = data.currentHouse, userGroup = data.userGroup, index = data.index })
    end
end
-- Setting Dialogs --
---------------------
    control.parentDialog.changedData[control.permissionSetting] = state
end
do
    local ALLOW_ACCESS = true
    local CANNOT_EDIT = false
    local function SetupPresetComboBox(dialog)
        local presetsComboBoxControl = GetControl(dialog, "Presets")
        dialog.presetsComboBox = ZO_ComboBox_ObjectFromContainer(presetsComboBoxControl)
        dialog.presetsComboBox:SetSortsItems(false)
        local function OnPresetSelected(_, entryText, entry)
            dialog.selectedPreset = entry.presetIndex
            dialog.presetsComboBox:SetSelectedItemText(entry.name)
        end
       
        local allPermissionPresets = HOUSE_SETTINGS_MANAGER:GetAllPermissionPresets()
        for i, presetName in pairs(allPermissionPresets) do
            if i ~= HOUSE_PERMISSION_PRESET_SETTING_INVALID then
                local entry = dialog.presetsComboBox:CreateItemEntry(presetName, OnPresetSelected)
                entry.presetIndex = i
                dialog.presetsComboBox:AddItem(entry)
            end
        end
    end
    local function SetupHousesComboBox(dialog)
        local housesComboBoxControl = GetControl(dialog, "HousesComboBox")
        dialog.housesComboBox = ZO_ComboBox_ObjectFromContainer(housesComboBoxControl)
        dialog.housesComboBox:SetSortsItems(false) -- sorted on setup
    end
    local function SetupChangePermissionsDialog(dialog)
        dialog:GetNamedChild("Header"):SetText(zo_strformat(SI_DIALOG_TEXT_CHANGE_HOUSING_PERMISSION, dialog.data.displayName))
        local data = dialog.data
        if dialog.presetsComboBox then
            dialog.presetsComboBox:SetSelectedItemText(data.permissionPresetName)
            dialog.selectedPreset = HOUSE_SETTINGS_MANAGER:GetHousingPresetIndex(data.permissionPresetName)
        end
        local allHousesCheckBoxControl = dialog:GetNamedChild("AllHouses")
        ZO_CheckButton_SetCheckState(allHousesCheckBoxControl, HOUSE_SETTINGS_MANAGER:GetApplyToAllHousesFlag())
    end
    local function SetupCopyPermissionsDialog(dialog)
        local data = dialog.data
        dialog.confirmButton:SetState(BSTATE_DISABLED, false)
        if dialog.housesComboBox then
            local INVALID_HOUSE_ID = -1
            dialog.housesComboBox:ClearItems()
            dialog.selectedHouseId = INVALID_HOUSE_ID
            local function OnHouseSelected(_, entryText, entry)
                dialog.selectedHouseId = entry.houseId
                dialog.housesComboBox:SetSelectedItemText(entry.name)
                dialog.confirmButton:SetState(BSTATE_NORMAL, true)
            end
            
            HOUSE_SETTINGS_MANAGER:SetupCopyPermissionsCombobox(dialog.housesComboBox, dialog.data.currentHouse, OnHouseSelected)
        end
    end
        ZO_Dialogs_RegisterCustomDialog("CHANGE_HOUSING_PERMISSIONS",
        {
            customControl = self,
            setup = SetupChangePermissionsDialog,
            canQueue = true,
            title =
            {
                text = SI_DIALOG_TITLE_CHANGE_HOUSING_PERMISSION,
            },
            buttons =
            {
                {
                    keybind = "DIALOG_PRIMARY",
                    control = self:GetNamedChild("Confirm"),
                    text = SI_DIALOG_BUTTON_CHANGE_HOUSING_PERMISSION,
                    callback = function(dialog)
                        local editCheckBoxControl = dialog:GetNamedChild("AllHouses")
                        local isAllHousesChecked = ZO_CheckButton_IsChecked(editCheckBoxControl)
                        HOUSE_SETTINGS_MANAGER:SetApplyToAllHousesFlag(isAllHousesChecked)
                        local data = dialog.data
                        SetHousingPermissionPreset(data.currentHouse, data.userGroup, data.index, dialog.selectedPreset, isAllHousesChecked)
                    end
                },
                {
                    control = self:GetNamedChild("Cancel"),
                    text = SI_DIALOG_CANCEL,
                },
            },
        })
        SetupPresetComboBox(self)
    end
    local function SetupRemovePermissionsDialog(dialog)
        dialog:GetNamedChild("Title"):SetText(dialog.data.titleText)
        dialog:GetNamedChild("Header"):SetText(dialog.data.headerText)
        local editCheckBoxControl = dialog:GetNamedChild("AllHouses")
        ZO_CheckButton_SetCheckState(editCheckBoxControl, HOUSE_SETTINGS_MANAGER:GetApplyToAllHousesFlag())
    end
        ZO_Dialogs_RegisterCustomDialog("CONFIRM_REMOVE_PERMISSIONS",
        {
            customControl = self,
            setup = SetupRemovePermissionsDialog,
            buttons =
            {
                {
                    control = self:GetNamedChild("Confirm"),
                    text = SI_DIALOG_CONFIRM,
                    callback =  function(dialog)
                                    local data = dialog.data
                                    local editCheckBoxControl = dialog:GetNamedChild("AllHouses")
                                    local isAllHousesChecked = ZO_CheckButton_IsChecked(editCheckBoxControl)
                                    HOUSE_SETTINGS_MANAGER:SetApplyToAllHousesFlag(isAllHousesChecked)
                                    RemoveHousingPermission(data.currentHouse, data.userGroup, data.index, isAllHousesChecked)
                                end
                },
                {
                    control = self:GetNamedChild("Cancel"),
                    text = SI_DIALOG_CANCEL,
                },
            },
        })
    end
    local function SetupAddOrBanUserGroupDialog(dialog)
        local data = dialog.data
        local activePanel = data.activePanel
        local dialogTitle = activePanel:GetAddUserGroupDialogTitle()
        dialog:GetNamedChild("Title"):SetText(dialogTitle)
        GetControl(dialog, "NameEdit"):SetText("")
        local editCheckBoxControl = dialog:GetNamedChild("AllHouses")
        ZO_CheckButton_SetCheckState(editCheckBoxControl, HOUSE_SETTINGS_MANAGER:GetApplyToAllHousesFlag())
        if dialog.presetsComboBox then
            local defaultPreset = HOUSE_SETTINGS_MANAGER:GetDefaultPreset()
            local allPermissionPresets = HOUSE_SETTINGS_MANAGER:GetAllPermissionPresets()
            dialog.presetsComboBox:SetSelectedItemText(allPermissionPresets[defaultPreset])
            dialog.selectedPreset = defaultPreset
        end
    end
    function ZO_RequestAddUserGroupDialog_OnInitialized(self, dialogName)
        ZO_Dialogs_RegisterCustomDialog(dialogName,
        {
            customControl = self,
            setup = SetupAddOrBanUserGroupDialog,
            buttons =
            {
                {
                    control = self:GetNamedChild("Confirm"),
                    text = SI_DIALOG_CONFIRM,
                    callback =  function(dialog)
                                    local data = dialog.data
                                    local activePanel = data.activePanel
                                    local userGroup = activePanel:GetUserGroup()
                                    local editCheckBoxControl = dialog:GetNamedChild("AllHouses")
                                    local isAllHousesChecked = ZO_CheckButton_IsChecked(editCheckBoxControl)
                                    HOUSE_SETTINGS_MANAGER:SetApplyToAllHousesFlag(isAllHousesChecked)
                                    local name = GetControl(dialog, "NameEdit"):GetText()
                                    AddHousingPermission(data.currentHouse, userGroup, ALLOW_ACCESS, dialog.selectedPreset, isAllHousesChecked, name)
                                end
                },
                {
                    control = self:GetNamedChild("Cancel"),
                    text = SI_DIALOG_CANCEL,
                },
            },
        })
        SetupPresetComboBox(self)
        local addUserGroupFields = ZO_RequiredTextFields:New()
        addUserGroupFields:AddButton(GetControl(self, "Confirm"))
        addUserGroupFields:AddTextField(GetControl(self, "NameEdit"))
    end
    function ZO_RequestBanUserGroupDialog_OnInitialized(self, dialogName)
        ZO_Dialogs_RegisterCustomDialog(dialogName,
        {
            customControl = self,
            setup = SetupAddOrBanUserGroupDialog,
            buttons =
            {
                {
                    control = self:GetNamedChild("Confirm"),
                    text = SI_DIALOG_CONFIRM,
                    callback =  function(dialog)
                                    local data = dialog.data
                                    local activePanel = data.activePanel
                                    local userGroup = activePanel:GetUserGroup()
                                    local editCheckBoxControl = dialog:GetNamedChild("AllHouses")
                                    local isAllHousesChecked = ZO_CheckButton_IsChecked(editCheckBoxControl)
                                    HOUSE_SETTINGS_MANAGER:SetApplyToAllHousesFlag(isAllHousesChecked)
                                    local name = GetControl(dialog, "NameEdit"):GetText()
                                    AddHousingPermission(data.currentHouse, userGroup, not ALLOW_ACCESS, HOUSE_PERMISSION_PRESET_SETTING_INVALID, isAllHousesChecked, name)
                                end
                },
                {
                    control = self:GetNamedChild("Cancel"),
                    text = SI_DIALOG_CANCEL,
                },
            },
        })
        local banUserGroupFields = ZO_RequiredTextFields:New()
        banUserGroupFields:AddButton(GetControl(self, "Confirm"))
        banUserGroupFields:AddTextField(GetControl(self, "NameEdit"))
    end
        self.confirmButton = self:GetNamedChild("Confirm")
        ZO_Dialogs_RegisterCustomDialog("COPY_HOUSING_PERMISSIONS",
        {
            customControl = self,
            setup = SetupCopyPermissionsDialog,
            canQueue = true,
            title =
            {
                text = SI_DIALOG_COPY_HOUSING_PERMISSION_TITLE,
            },
            buttons =
            {
                {
                    keybind = "DIALOG_PRIMARY",
                    control = self.confirmButton,
                    text = SI_DIALOG_CONFIRM,
                    callback = function(dialog)
                        local data = dialog.data
                        CopyHousePermissions(dialog.selectedHouseId, data.currentHouse)
                    end
                },
                {
                    control = self:GetNamedChild("Cancel"),
                    text = SI_DIALOG_CANCEL,
                },
            },
        })
        SetupHousesComboBox(self)
    end
end