-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAddonShell.lua
More file actions
52 lines (40 loc) · 1.91 KB
/
AddonShell.lua
File metadata and controls
52 lines (40 loc) · 1.91 KB
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
-- About AddonName.lua
--
-- Author: Bill Jones III, SUNY Geneseo, IDS Project, jonesw@geneseo.edu
-- AddonName.lua provides a basic shell structure for an Addon.
-- There is a config file that is associated with this Addon.
-- scriptActive must be set to true for the script to run.
-- autoSearch (boolean) determines whether the search is performed automatically when a request is opened or not.
--
-- set autoSearch to true for this script to automatically run the search when the request is opened.
local settings = {};
settings.autoSearch = GetSetting("AutoSearch");
local interfaceMngr = nil;
local AddonNameForm = {};
AddonNameForm.Form = nil;
AddonNameForm.Browser = nil;
AddonNameForm.RibbonPage = nil;
function Init()
-- The line below makes this Addon only work on Loan Transactions.
if GetFieldValue("Transaction", "RequestType") == "Loan" then
interfaceMngr = GetInterfaceManager();
-- Create browser
AddonNameForm.Form = interfaceMngr:CreateForm("AddonName", "Script");
AddonNameForm.Browser = AddonNameForm.Form:CreateBrowser("AddonName", "AddonName", "AddonName");
-- Hide the text label
AddonNameForm.Browser.TextVisible = false;
--Suppress Javascript errors
AddonNameForm.Browser.WebBrowser.ScriptErrorsSuppressed = true;
-- Since we didn't create a ribbon explicitly before creating our browser, it will have created one using the name we passed the CreateBrowser method. We can retrieve that one and add our buttons to it.
AddonNameForm.RibbonPage = AddonNameForm.Form:GetRibbonPage("AddonName");
-- The GetClientImage("Search32") pulls in the magnifying glass icon. There are other icons that can be used.
AddonNameForm.RibbonPage:CreateButton("Search", GetClientImage("Search32"), "Search", "AddonName");
AddonNameForm.Form:Show();
if settings.autoSearch then
Search();
end
end
end
function Search()
--add code here
end